Skip to content

Update Cargo.toml with new targets; enhance CI workflow steps #134

Update Cargo.toml with new targets; enhance CI workflow steps

Update Cargo.toml with new targets; enhance CI workflow steps #134

Workflow file for this run

name: CD
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
# TARGET: x86_64-apple-darwin
TARGET: aarch64-unknown-linux-gnu
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
jobs:
build:
runs-on: macos-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Ensure no changes (1)
continue-on-error: true
run: git diff --exit-code --quiet && cargo check
- name: Git status
if: failure()
run: git status && exit 1
- name: Setup Git
run: |
git config user.name "Linus Oleander"
git config user.email "oleander@users.noreply.github.com"
- name: Cache target and cargo build
uses: actions/cache@v4
with:
path: |
~/.rustup/toolchains/
target/
key: ${{ runner.os }}-rustup-cargo-${{ env.TARGET }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rustup-cargo-${{ env.TARGET }}-
# - name: Add target (${{ env.TARGET }})
# run: rustup target add ${{ env.TARGET }}
- name: Install cargo-bump
run: cargo install cargo-bump
- name: Ensure no changes
run: git diff --exit-code --quiet && cargo check
- name: Git status
if: failure()
run: git status && exit 1
- name: Bump version
run: cargo bump patch --git-tag || git status
- name: Get the latest tag
run: git describe --tags --abbrev=0 HEAD
id: version
- name: Include the version bump in the commit message
run: git commit -a --amend --no-edit
# - name: Publish to crates.io
# run: cargo publish --allow-dirty --dry-run
- name: Build for target (${{ env.TARGET }})
run: cargo build -Z unstable-options --profile dev --artifact-dir bin --target ${{ env.TARGET }}
- name: List all targets
run: |
ls -halt bin/
pwd
realpath bin/
- name: Upload Binary
uses: actions/upload-artifact@v4
id: upload-artifact
with:
name: v${{ steps.version.outputs.version }}-${{ runner.os }}
if-no-files-found: error
path: bin/{git-ai,git-ai-hook}
- name: Print the artifact URL
run: echo ${{ steps.upload-artifact.outputs.artifact-url }}
- name: Push to origin
run: git push origin HEAD