Fix tar command path in GitHub Actions workflow #111
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: | |
- "**" | |
branches: | |
- "main" | |
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: Add target | |
run: rustup target add x86_64-unknown-linux-gnu | |
- name: Build for x86_64-unknown-linux-gnu | |
run: cargo build --release --target x86_64-unknown-linux-gnu | |
- name: Package Binary | |
run: tar czf git-ai.tar.gz -C target/*/release 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: git-ai.tar.gz | |
build-arm: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add target | |
run: rustup target add aarch64-apple-darwin | |
- name: Build for aarch64-apple-darwin | |
run: cargo build --release --target aarch64-apple-darwin | |
- name: Package Binary | |
run: tar czf git-ai.tar.gz -C target/*/release git-ai git-ai-hook | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-ai-aarch64-apple-darwin.tar.gz | |
path: git-ai.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: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: git-ai-*.tar.gz | |
tag_name: ${{ github.ref_name }} | |
- name: Publish to crates.io | |
run: cargo publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |