Release Pipeline #21
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 Pipeline | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
# Build for Windows | |
build_windows: | |
runs-on: windows-latest # Use Windows runner | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: clippy | |
- name: Build for Windows | |
run: | | |
cargo build --release | |
mkdir -p output/win | |
cp target/release/aid.exe output/win/aid-win.exe | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-artifact | |
path: output/win/aid-win.exe | |
# Build for Linux x86_64 | |
build_linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: clippy | |
- name: Build for Linux | |
run: | | |
cargo build --release | |
mkdir -p output/linux | |
cp target/release/aid output/linux/aid-linux | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-artifact | |
path: output/linux/aid-linux | |
# Build for macOS x86_64 | |
build_macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: clippy | |
- name: Build for macOS | |
run: | | |
cargo build --release | |
mkdir -p output/osx | |
cp target/release/aid output/osx/aid-mac | |
- name: Upload macOS artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-artifact | |
path: output/osx/aid-mac | |
# Build for Linux ARM64 | |
build_linux_arm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev pkg-config | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
target: aarch64-unknown-linux-gnu # Add ARM64 target | |
components: clippy | |
- name: Set environment variables for OpenSSL | |
run: | | |
export PKG_CONFIG_ALLOW_CROSS=1 | |
export PKG_CONFIG_SYSROOT_DIR="/usr/aarch64-linux-gnu" | |
export PKG_CONFIG_PATH="/usr/aarch64-linux-gnu/lib/pkgconfig" | |
export OPENSSL_DIR=/usr/aarch64-linux-gnu/lib/openssl | |
- name: Build for Linux ARM | |
run: | | |
cargo build --release --target aarch64-unknown-linux-gnu | |
mkdir -p output/linux_arm | |
cp target/aarch64-unknown-linux-gnu/release/aid output/linux_arm/aid-linux-arm | |
- name: Upload Linux ARM artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-arm-artifact | |
path: output/linux_arm/aid-linux-arm | |
# Build for macOS ARM (Apple Silicon) | |
build_macos_arm: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
target: aarch64-apple-darwin # Add macOS ARM target | |
components: clippy | |
- name: Build for macOS ARM | |
run: | | |
cargo build --release --target aarch64-apple-darwin | |
mkdir -p output/osx_arm | |
cp target/aarch64-apple-darwin/release/aid output/osx_arm/aid-mac-arm | |
- name: Upload macOS ARM artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-arm-artifact | |
path: output/osx_arm/aid-mac-arm | |
# Create a single GitHub release with all artifacts | |
create_release: | |
runs-on: ubuntu-latest | |
needs: [build_windows, build_linux, build_macos, build_linux_arm, build_macos_arm] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Download artifacts from previous jobs | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows-artifact | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-artifact | |
- name: Download macOS artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos-artifact | |
- name: Download Linux ARM artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-arm-artifact | |
- name: Download macOS ARM artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos-arm-artifact | |
- name: Generate release tag | |
id: tag | |
run: | | |
VERSION=0.1.6 | |
echo "::set-output name=release_tag::aid-${VERSION}" | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
files: | | |
aid-win.exe | |
aid-linux | |
aid-mac | |
aid-linux-arm | |
aid-mac-arm |