Update CD workflow; remove step and adjust if condition #167
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: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
ACTIONS_RUNTIME_TOKEN: dummy | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
runs-on: ${{ matrix.os }} | |
continue-on-error: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Ensure no changes (1) | |
run: git diff --exit-code --quiet && cargo check | |
continue-on-error: true | |
- name: Git status | |
if: failure() | |
run: git status && exit 1 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: ${{ matrix.target }} | |
override: true | |
profile: minimal | |
- name: Add Specific Targets | |
run: | | |
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then | |
rustup target add x86_64-unknown-linux-musl | |
sudo apt-get update && sudo apt-get install -y musl-tools | |
elif [[ "${{ matrix.target }}" == "wasm32-unknown-unknown" ]]; then | |
rustup target add wasm32-unknown-unknown | |
fi | |
- name: Install Dependencies for musl Target | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config libssl-dev | |
- name: Ensure no changes | |
run: git diff --exit-code --quiet && cargo check | |
- name: Git status | |
if: failure() | |
run: git status && exit 1 | |
- name: Build for target | |
run: cargo build -Z unstable-options --profile dev --artifact-dir bin --target ${{ matrix.target }} | |
- name: List all targets | |
run: | | |
ls -halt bin/ | |
pwd | |
realpath bin/ | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-ai-${{ matrix.target }} | |
if-no-files-found: error | |
path: | | |
bin/git-ai | |
bin/git-ai-hook | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
profile: minimal | |
- name: Setup Git | |
run: | | |
git config user.name "Linus Oleander" | |
git config user.email "[email protected]" | |
- name: Install cargo-bump | |
run: cargo install cargo-bump | |
- name: Bump version | |
run: | | |
cargo bump patch --git-tag | |
cargo check | |
- name: Commit Version Bump | |
run: git commit -a --amend --no-edit | |
- name: Publish to crates.io | |
run: cargo publish --allow-dirty | |
- name: Push to origin | |
run: git push origin HEAD --tags | |
# precompile: | |
# if: github.event.ref == 'refs/tags/*' | |
# needs: release | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Release | |
# uses: softprops/action-gh-release@v2 | |
# with: | |
# files: Release.txt |