v0.1 #3
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: Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
release: | |
name: Release - ${{ matrix.platform.release_for }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- release_for: Linux-x86_64 | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- release_for: macOS-Intel | |
os: macos-13 | |
target: x86_64-apple-darwin | |
- release_for: macOS-ARM | |
os: macos-latest | |
target: aarch64-apple-darwin | |
- release_for: Windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.platform.target }} | |
- name: Build | |
run: cargo build -p rere --verbose --release --target ${{ matrix.platform.target }} | |
- name: Rename binary | |
run: | | |
cd target/${{ matrix.platform.target }}/release | |
mv rere${{ matrix.platform.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} rere-${{ matrix.platform.release_for }}${{ matrix.platform.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | |
- name: Generate SHA256 checksum | |
shell: bash | |
run: | | |
cd target/${{ matrix.platform.target }}/release | |
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then | |
powershell -Command "(Get-FileHash rere-${{ matrix.platform.release_for }}.exe -Algorithm SHA256).Hash.ToLower() + ' rere-${{ matrix.platform.release_for }}.exe'" > rere-${{ matrix.platform.release_for }}.sha256 | |
else | |
shasum -a 256 rere-${{ matrix.platform.release_for }} > rere-${{ matrix.platform.release_for }}.sha256 | |
fi | |
- name: Upload SHA256 checksum | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./target/${{ matrix.platform.target }}/release/rere-${{ matrix.platform.release_for }}.sha256 | |
asset_name: rere-${{ matrix.platform.release_for }}.sha256 | |
asset_content_type: text/plain | |
- name: Upload Release Asset (Binary) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./target/${{ matrix.platform.target }}/release/rere-${{ matrix.platform.release_for }}${{ matrix.platform.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | |
asset_name: rere-${{ matrix.platform.release_for }}${{ matrix.platform.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | |
asset_content_type: application/octet-stream |