Add concurrency setting to GitHub Actions CD workflow #107
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: CD | |
on: | |
push: | |
tags: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-x86: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build for x86_64-unknown-linux-gnu | |
run: | | |
rustup target add x86_64-unknown-linux-gnu | |
cargo build --release --target x86_64-unknown-linux-gnu | |
- name: Package Binary | |
run: | | |
cd target/x86_64-unknown-linux-gnu/release | |
tar czf git-ai-x86_64-unknown-linux-gnu.tar.gz git-ai git-ai-hook | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-ai-x86_64-unknown-linux-gnu.tar.gz | |
path: target/x86_64-unknown-linux-gnu/release/git-ai-x86_64-unknown-linux-gnu.tar.gz | |
build-arm: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build for aarch64-apple-darwin | |
run: | | |
rustup target add aarch64-apple-darwin | |
cargo build --release --target aarch64-apple-darwin | |
- name: Package Binary | |
run: | | |
cd target/aarch64-apple-darwin/release | |
tar czf git-ai-aarch64-apple-darwin.tar.gz git-ai git-ai-hook | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-ai-aarch64-apple-darwin.tar.gz | |
path: target/aarch64-apple-darwin/release/git-ai-aarch64-apple-darwin.tar.gz | |
release: | |
needs: [build-x86, build-arm] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Get version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
git-ai-x86_64-unknown-linux-gnu.tar.gz/git-ai-x86_64-unknown-linux-gnu.tar.gz | |
git-ai-aarch64-apple-darwin.tar.gz/git-ai-aarch64-apple-darwin.tar.gz | |
draft: false | |
prerelease: false | |
- name: Publish to crates.io | |
run: cargo publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |