calcifer/.github/workflows/release.yml

68 lines
2.1 KiB
YAML
Raw Normal View History

permissions:
contents: write
actions: read
checks: write
deployments: write
issues: write
packages: write
pull-requests: write
statuses: write
on:
release:
types: [created]
jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64-pc-windows-gnu, x86_64-unknown-linux-musl]
steps:
2024-07-22 16:24:02 +02:00
- uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install mingw-w64 for Windows target
if: matrix.target == 'x86_64-pc-windows-gnu'
run: sudo apt-get install mingw-w64
- name: Install musl-tools for Linux target
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get install musl-tools
2024-07-22 16:24:02 +02:00
- name: Install target
run: rustup target add ${{ matrix.target }}
- name: Compile the app
run: cargo build --release --target ${{ matrix.target }}
- name: Create tarball
run: |
release_tag=${{ github.event.release.tag_name }}
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then
tar -czvf calcifer_v${release_tag}.tar.gz -C target/${{ matrix.target }}/release calcifer
elif [[ "${{ matrix.target }}" == "x86_64-pc-windows-gnu" ]]; then
tar -czvf calcifer_windows_v${release_tag}.tar.gz -C target/${{ matrix.target }}/release calcifer.exe
fi
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: |
calcifer_v${{ github.event.release.tag_name }}.tar.gz
calcifer_windows_v${{ github.event.release.tag_name }}.tar.gz
asset_name: |
calcifer_v${{ github.event.release.tag_name }}.tar.gz
calcifer_windows_v${{ github.event.release.tag_name }}.tar.gz
asset_content_type: application/gzip