Update CD workflow to use 'minimal' profile #141
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: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
# TARGET: x86_64-apple-darwin | |
# TARGET: aarch64-unknown-linux-gnu | |
TARGET: x86_64-unknown-linux-gnu | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
ACTIONS_RUNTIME_TOKEN: dummy | |
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: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rust-src,cargo | |
target: ${{ env.TARGET }} | |
override: true | |
profile: minimal | |
- 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 -Zunstable-options -Zbuild-std --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 | |
bin/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 |