Fix git push URL syntax in CD workflow file #121
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: 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 | |
if-no-files-found: error | |
compression-level: 9 | |
overwrite: true | |
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 | |
if-no-files-found: error | |
overwrite: true | |
compression-level: 9 | |
path: git-ai.tar.gz | |
release: | |
needs: [build-x86, build-arm] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Git | |
run: | | |
git config user.name "Linus Oleander" | |
git config user.email "oleander@users.noreply.github.com" | |
- name: Install cargo-bump | |
run: cargo install cargo-bump | |
- name: Bump version | |
run: | | |
git diff-index --quiet HEAD -- || git stash | |
cargo bump patch --git-tag | |
git diff-index --quiet HEAD -- || git commit -a --amend --no-edit | |
git push origin/main --tags | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
git-ai-x86_64-unknown-linux-gnu.tar.gz/git-ai.tar.gz | |
git-ai-aarch64-apple-darwin.tar.gz/git-ai.tar.gz | |
tag_name: ${{ github.ref_name }} | |
- name: Publish to crates.io | |
run: cargo publish --allow-dirty | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |