mirror of
https://github.com/typst/typst
synced 2025-05-18 11:05:28 +08:00
Add more release build targets (#847)
This commit is contained in:
parent
d0afba959d
commit
6591a92e85
85
.github/workflows/release.yml
vendored
85
.github/workflows/release.yml
vendored
@ -8,55 +8,70 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-release:
|
build-release:
|
||||||
name: build-release
|
name: release ${{ matrix.target }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
build: [linux, macos, win-msvc]
|
|
||||||
include:
|
include:
|
||||||
- build: linux
|
- target: x86_64-unknown-linux-musl
|
||||||
os: ubuntu-22.04
|
os: ubuntu-latest
|
||||||
target: x86_64-unknown-linux-gnu
|
cross: false
|
||||||
- build: macos
|
- target: aarch64-unknown-linux-musl
|
||||||
os: macos-12
|
os: ubuntu-latest
|
||||||
target: x86_64-apple-darwin
|
cross: true
|
||||||
- build: win-msvc
|
- target: armv7-unknown-linux-musleabi
|
||||||
os: windows-2022
|
os: ubuntu-latest
|
||||||
target: x86_64-pc-windows-msvc
|
cross: true
|
||||||
|
- target: riscv64gc-unknown-linux-gnu
|
||||||
|
os: ubuntu-latest
|
||||||
|
cross: true
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
os: macos-latest
|
||||||
|
cross: false
|
||||||
|
- target: aarch64-apple-darwin
|
||||||
|
os: macos-latest
|
||||||
|
cross: false
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
cross: false
|
||||||
|
- target: aarch64-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
cross: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build release binary
|
- name: Run Cross
|
||||||
run: cargo build -p typst-cli --release
|
if: ${{ matrix.cross}}
|
||||||
|
run: |
|
||||||
|
cargo install cross --git https://github.com/cross-rs/cross.git
|
||||||
|
cross build -p typst-cli --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Strip binary (Linux and macOS)
|
- name: Run Cargo
|
||||||
if: matrix.build == 'linux' || matrix.build == 'macos'
|
if: ${{ !matrix.cross }}
|
||||||
run: strip "target/release/typst"
|
run: cargo build -p typst-cli --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build archive
|
- name: create artifact directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
directory="typst-${{ matrix.target }}"
|
directory=typst-${{ matrix.target }}
|
||||||
mkdir "$directory"
|
mkdir $directory
|
||||||
cp {README.md,LICENSE,NOTICE} "$directory/"
|
cp README.md LICENSE NOTICE $directory
|
||||||
if [ "${{ matrix.os }}" = "windows-2022" ]; then
|
if [ -f target/${{ matrix.target }}/release/typst.exe ]; then
|
||||||
cp "target/release/typst.exe" "$directory/"
|
cp target/${{ matrix.target }}/release/typst.exe $directory
|
||||||
7z a "$directory.zip" "$directory"
|
7z a -r $directory.zip $directory
|
||||||
echo "ASSET=$directory.zip" >> $GITHUB_ENV
|
|
||||||
else
|
else
|
||||||
cp "target/release/typst" "$directory/"
|
cp target/${{ matrix.target }}/release/typst $directory
|
||||||
tar czf "$directory.tar.gz" "$directory"
|
tar cJf $directory.tar.xz $directory
|
||||||
echo "ASSET=$directory.tar.gz" >> $GITHUB_ENV
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload release archive
|
- uses: ncipollo/release-action@v1
|
||||||
uses: actions/upload-release-asset@v1.0.2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ github.event.release.upload_url }}
|
artifacts: "typst-${{ matrix.target }}.*"
|
||||||
asset_path: ${{ env.ASSET }}
|
allowUpdates: true
|
||||||
asset_name: ${{ env.ASSET }}
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user