Release Pipeline #16
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 | |
# Upload the Windows artifact | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-artifact | |
path: output/win/aid-win.exe | |
# Build for Linux | |
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 | |
# Upload the Linux artifact | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-artifact | |
path: output/linux/aid-linux | |
# Build for macOS | |
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 | |
# Upload the macOS artifact | |
- name: Upload macOS artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-artifact | |
path: output/osx/aid-mac | |
# Create a single GitHub release with all artifacts | |
create_release: | |
runs-on: ubuntu-latest | |
needs: [build_windows, build_linux, build_macos] | |
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: Generate release tag | |
id: tag | |
run: | | |
VERSION=0.1.5 | |
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 |