Skip to content

Add 'feature/bundle-bin' branch to CD workflow trigger #104

Add 'feature/bundle-bin' branch to CD workflow trigger

Add 'feature/bundle-bin' branch to CD workflow trigger #104

Workflow file for this run

name: CD
on:
push:
branches:
- main
- feature/bundle-bin
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:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Build for x86_64-unknown-linux-gnu
run: |
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
- name: Install cargo-binstall
run: cargo install cargo-binstall
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-x86_64
path: target/x86_64-unknown-linux-gnu/release/
build-arm:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Build for aarch64-apple-darwin
run: |
rustup target add aarch64-apple-darwin
cargo build --release --target aarch64-apple-darwin
- name: Install cargo-binstall
run: cargo install cargo-binstall
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-arm
path: target/aarch64-apple-darwin/release/
crate:
runs-on: ubuntu-latest
needs: [build-x86, build-arm]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rust-std
profile: minimal
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-crate-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-crate-
- name: Setup environment
run: |
git config user.name "Linus Oleander"
git config user.email "[email protected]"
cargo install cargo-bump --force
- name: Bump version
run: cargo bump patch --git-tag
- name: Release to crates.io (dry-run)
if: github.ref != 'refs/heads/main'
run: cargo publish --dry-run
- name: Release to crates.io
if: github.ref == 'refs/heads/main'
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Release to GitHub
if: github.ref == 'refs/heads/main'
run: git push origin HEAD --tags