v0.5.0 #83
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: reflexo::release | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
env: | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc | |
SCCACHE_GHA_ENABLED: 'true' | |
RUSTC_WRAPPER: 'sccache' | |
CARGO_INCREMENTAL: '0' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
rust-target: x86_64-pc-windows-msvc | |
platform: win32 | |
arch: x64 | |
- os: windows-latest | |
rust-target: i686-pc-windows-msvc | |
platform: win32 | |
arch: ia32 | |
- os: windows-latest | |
rust-target: aarch64-pc-windows-msvc | |
platform: win32 | |
arch: arm64 | |
- os: ubuntu-latest | |
rust-target: x86_64-unknown-linux-gnu | |
platform: linux | |
arch: x64 | |
- os: ubuntu-latest | |
rust-target: aarch64-unknown-linux-gnu | |
platform: linux | |
arch: arm64 | |
- os: ubuntu-latest | |
rust-target: arm-unknown-linux-gnueabihf | |
platform: linux | |
arch: armhf | |
- os: macos-13 | |
rust-target: x86_64-apple-darwin | |
platform: darwin | |
arch: x64 | |
- os: macos-13 | |
rust-target: aarch64-apple-darwin | |
platform: darwin | |
arch: arm64 | |
name: build (${{ matrix.rust-target }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
target: ${{ matrix.platform }}-${{ matrix.arch }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.rust-target }} | |
- name: Install AArch64 target toolchain | |
if: matrix.rust-target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install ARM target toolchain | |
if: matrix.rust-target == 'arm-unknown-linux-gnueabihf' | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install gcc-arm-linux-gnueabihf | |
- name: Run Native Build | |
shell: pwsh | |
run: | | |
cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.rust-target }} --bin typst-ts-cli | |
cargo build --profile relwithdebinfo --manifest-path cli/Cargo.toml --target ${{ matrix.rust-target }} --bin typst-ts-cli | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-${{ env.target }} | |
path: target/${{ matrix.rust-target }}/release/typst-ts-* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-${{ env.target }}-relwithdebuginfo | |
path: target/${{ matrix.rust-target }}/relwithdebinfo/typst-ts-* | |
if-no-files-found: error | |
build_linux_riscv64: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
rust-target: riscv64gc-unknown-linux-gnu | |
platform: linux | |
arch: riscv64 | |
name: build (${{ matrix.rust-target }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
target: ${{ matrix.platform }}-${{ matrix.arch }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.rust-target }} | |
- name: Build cross image | |
run: | | |
docker build -t typst-ts/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ | |
env: | |
CROSS_DOCKER_IN_DOCKER: true | |
- name: Run Cross Build | |
run: | | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build --manifest-path cli/Cargo.toml --release --target ${CARGO_TARGET} --bin typst-ts-cli | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build --manifest-path cli/Cargo.toml --profile relwithdebinfo --target ${CARGO_TARGET} --bin typst-ts-cli | |
env: | |
CROSS_DOCKER_IN_DOCKER: true | |
CARGO_TARGET: ${{ matrix.rust-target }} | |
PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig | |
PKG_CONFIG_ALLOW_CROSS: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-${{ env.target }} | |
path: target/${{ matrix.rust-target }}/release/typst-ts-* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-${{ env.target }}-relwithdebuginfo | |
path: target/${{ matrix.rust-target }}/relwithdebinfo/typst-ts-* | |
if-no-files-found: error | |
build_alpine: | |
name: build (x86_64-unknown-linux-musl) | |
runs-on: ubuntu-latest | |
container: | |
image: rust:alpine | |
volumes: | |
- /usr/local/cargo/registry:/usr/local/cargo/registry | |
env: | |
target: alpine-x64 | |
RUST_TARGET: x86_64-unknown-linux-musl | |
RUSTFLAGS: '-C link-arg=-fuse-ld=lld -C target-feature=-crt-static' | |
steps: | |
- name: Install dependencies | |
run: apk add --no-cache git clang lld musl-dev npm | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Configure git | |
run: | | |
git config --global --add safe.directory $PWD | |
- name: build binaries | |
run: | | |
cargo build --release --manifest-path cli/Cargo.toml --target $RUST_TARGET --bin typst-ts-cli | |
cargo build --profile relwithdebinfo --manifest-path cli/Cargo.toml --target $RUST_TARGET --bin typst-ts-cli | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-font-assets | |
path: assets | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-${{ env.target }} | |
path: target/${{ env.RUST_TARGET }}/release/typst-ts-* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: typst-ts-${{ env.target }}-relwithdebuginfo | |
path: target/${{ env.RUST_TARGET }}/relwithdebinfo/typst-ts-* | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
needs: [build, build_linux_riscv64, build_alpine] | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: Display structure of downloaded files | |
run: find artifacts | |
- run: | | |
set -ex | |
mkdir -p gh-release/ | |
pack_release() { | |
target=$2 | |
src=typst-ts-$1 | |
name=typst-ts-$target | |
mkdir -p tmp/$name | |
rm -f artifacts/$src/*.d | |
rm -f artifacts/$src/*.pdb | |
mkdir -p release/$name/bin | |
cp artifacts/$src-relwithdebuginfo/typst-ts-* "release/$name/bin/" | |
cp -r CHANGELOG release/$name/ | |
cp -r docs release/$name/ | |
cp README.md \ | |
LICENSE \ | |
CHANGELOG.md \ | |
release/$name/ | |
chmod +x release/$name/bin/typst-ts-* | |
tar czvf gh-release/$name-relwithdebuginfo.tar.gz -C release $name | |
mkdir -p release/$name/bin | |
cp artifacts/$src/typst-ts-* "release/$name/bin/" | |
cp -r CHANGELOG release/$name/ | |
cp -r docs release/$name/ | |
cp README.md \ | |
LICENSE \ | |
CHANGELOG.md \ | |
release/$name/ | |
chmod +x release/$name/bin/typst-ts-* | |
tar czvf gh-release/$name.tar.gz -C release $name | |
} | |
pack_release win32-x64 x86_64-pc-windows-msvc | |
pack_release win32-ia32 i686-pc-windows-msvc | |
pack_release win32-arm64 aarch64-pc-windows-msvc | |
pack_release linux-x64 x86_64-unknown-linux-gnu | |
pack_release linux-arm64 aarch64-unknown-linux-gnu | |
pack_release linux-armhf arm-unknown-linux-gnueabihf | |
pack_release linux-riscv64 riscv64gc-unknown-linux-gnu | |
pack_release darwin-x64 x86_64-apple-darwin | |
pack_release darwin-arm64 aarch64-apple-darwin | |
pack_release alpine-x64 alpine-x64 | |
pack_release alpine-x64 x86_64-unknown-linux-musl | |
# typst-ts-font-assets | |
mkdir -p release/font-assets | |
cp -r artifacts/typst-ts-font-assets/* release/font-assets/ | |
tar czvf gh-release/font-assets.tar.gz -C release font-assets | |
- name: Display structure of releasing files | |
run: find gh-release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: gh-release | |
path: gh-release | |
- uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: 'gh-release/*' | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitDraftDuringUpdate: true | |
omitNameDuringUpdate: true | |
omitPrereleaseDuringUpdate: true |