Skip to content

Release v0.4.5

Release v0.4.5 #17

Workflow file for this run

name: Release
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
name: Build ${{ matrix.target.name }} package
runs-on: ${{ matrix.target.os }}
strategy:
matrix:
target:
[
{ name: aarch64-apple-darwin, os: macos-latest },
{ name: x86_64-apple-darwin, os: macos-latest },
{
name: x86_64-pc-windows-msvc,
os: windows-latest,
extension: .exe,
},
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
]
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Setup Rust toolchain
run: rustup target add ${{ matrix.target.name }}
- name: Setup build environment (macOS)
if: matrix.target.os == 'macos-latest'
env:
APPLE_CERTIFICATES_P12: ${{ secrets.APPLE_CERTIFICATES_P12 }}
APPLE_CERTIFICATES_PWD: ${{ secrets.APPLE_CERTIFICATES_PWD }}
run: |
brew update
brew install create-dmg
cargo install cargo-bundle
echo "$APPLE_CERTIFICATES_P12" | base64 --decode > certificate.p12
security create-keychain -p actions temp.keychain
security import certificate.p12 -k temp.keychain -P "$APPLE_CERTIFICATES_PWD" -T /usr/bin/codesign
security list-keychains -d user -s temp.keychain
security unlock-keychain -p actions temp.keychain
security set-key-partition-list -S apple-tool:,apple: -s -k actions temp.keychain
- name: Setup build environment (Linux)
if: matrix.target.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libxdo-dev
- name: Build
run: cargo build --profile ci-release --locked --target ${{ matrix.target.name }}
- name: Bundle (macOS)
if: matrix.target.os == 'macos-latest'
run: cargo bundle --profile ci-release --target ${{ matrix.target.name }}
- name: Codesign (macOS)
if: matrix.target.os == 'macos-latest'
run: |
codesign --deep --force --verify --verbose --sign "Xavier Lau" target/${{ matrix.target.name }}/ci-release/bundle/osx/AiR.app
# TODO: notarize the app.
- name: Pack (macOS)
if: matrix.target.os == 'macos-latest'
run: .github/create-dmg ${{ matrix.target.name }}
- name: Pack (Windows)
if: matrix.target.os == 'windows-latest'
run: |
mv target/${{ matrix.target.name }}/ci-release/air${{ matrix.target.extension }} .
Compress-Archive -Path air${{ matrix.target.extension }} -DestinationPath AiR-${{ matrix.target.name }}.zip
- name: Pack (Linux)
if: matrix.target.os == 'ubuntu-latest'
run: |
mv target/${{ matrix.target.name }}/ci-release/air${{ matrix.target.extension }} .
tar -czvf AiR-${{ matrix.target.name }}.tar.gz air${{ matrix.target.extension }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: AiR-${{ matrix.target.name }}
path: AiR-${{ matrix.target.name }}.*
retention-days: 1
release:
name: Release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Hash
run: |
mkdir -p artifacts
mv AiR-*/* artifacts/
cd artifacts
sha256sum * | tee ../SHA256
md5sum * | tee ../MD5
mv ../SHA256 .
mv ../MD5 .
- name: Publish
uses: softprops/action-gh-release@v2
with:
discussion_category_name: Announcements
generate_release_notes: true
files: artifacts/*
# publish-on-crates-io:
# name: Publish on crates.io
# runs-on: ubuntu-latest
# steps:
# - name: Fetch latest code
# uses: actions/checkout@v4
# - name: Login
# run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
# - name: Publish
# run: cargo publish --locked