Skip to content

build(deps): bump actions/upload-artifact from 4 to 6 #15

build(deps): bump actions/upload-artifact from 4 to 6

build(deps): bump actions/upload-artifact from 4 to 6 #15

Workflow file for this run

name: Build typst
on:
workflow_dispatch:
inputs:
ref:
description: The branch, tag or SHA in https://github.com/typst/typst.
default: main
type: string
release:
description: Whether to publish artifacts in a new release.
default: false
type: boolean
pull_request:
paths:
- .github/workflows/typst.yaml
# The following lines are based on `{release,ci}.yml` in typst/typst, licensed under Apache-2.0.
# https://github.com/typst/typst/tree/586b049487bfe696eb765a51403e6215d7f91315/.github/workflows/
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
env:
INPUT_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || 'main' }}
INPUT_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.release || false }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
bits: 64
os: ubuntu-latest
cross: true
- target: x86_64-pc-windows-msvc
bits: 64
os: windows-latest
cross: false
steps:
- uses: actions/checkout@v4
with:
repository: typst/typst
ref: ${{ env.INPUT_REF }}
- uses: actions/checkout@v4
with:
path: dev-builds
- uses: actions/setup-python@v6
if: ${{ matrix.os == 'windows-latest' }}
with:
# `get_revision.py` requires Python 3.11+,
# but as of 2025-09-29, windows-latest has Python 3.9.
python-version: '3.12'
- name: Report the revision
shell: bash
id: report
run: |
set -euxo pipefail
revision=$(python dev-builds/scripts/get_revision.py)
echo "Revision: $revision"
echo "revision=$revision" >> "$GITHUB_OUTPUT"
echo "Revision: \`$revision\`." >> "$GITHUB_STEP_SUMMARY"
- uses: dtolnay/rust-toolchain@1.89.0
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.bits }}
- name: Build typst using cross
if: ${{ matrix.cross }}
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall cross --force # Even if cached, reinstall to set PATH properly.
cross build -p typst-cli --release --target ${{ matrix.target }} --features self-update,vendor-openssl
- name: Build typst using cargo
if: ${{ !matrix.cross }}
run: cargo build -p typst-cli --release --target ${{ matrix.target }} --features self-update
- name: Prepare to upload
shell: bash
run: |
set -euxo pipefail
directory=typst-${{ matrix.target }}
mkdir $directory
cp README.md LICENSE NOTICE $directory
if [ -f target/${{ matrix.target }}/release/typst.exe ]; then
cp target/${{ matrix.target }}/release/typst.exe $directory
7z a -r $directory.zip $directory
else
cp target/${{ matrix.target }}/release/typst $directory
tar cJf $directory.tar.xz $directory
fi
- uses: actions/upload-artifact@v6
with:
name: typst-${{ matrix.target }}
path: "typst-${{ matrix.target }}.*"
- uses: softprops/action-gh-release@v2
if: ${{ env.INPUT_RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.report.outputs.revision }}
name: ${{ steps.report.outputs.revision }}
draft: true
prerelease: false # can be edited in the Web UI
files: |
typst-${{ matrix.target }}.*
- name: Report the release
if: ${{ env.INPUT_RELEASE == 'true' }}
run: |
echo "Please publish the [draft release](https://github.com/typst-community/dev-builds/releases)." >> "$GITHUB_STEP_SUMMARY"