name: Release
on:
workflow_dispatch:
inputs:
version:
description: "The benchie version to build artifacts for"
type: string
required: true
workflow_call:
inputs:
version:
description: "The benchie version to build artifacts for"
type: string
required: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
release:
name: Release
runs-on: ubuntu-22.04
permissions:
contents: "write"
id-token: "write"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Install Rust Toolchain
uses: ./.github/actions/setup-rust/
- name: Install Cargo Edit
run: cargo install cargo-edit
- name: Assign Release Version from Tag
run: |
cargo set-version "${{ github.event.inputs.version }}"
cargo update --package benchie --precise "${{ github.event.inputs.version }}"
- name: Commit Version Update
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add Cargo.toml
git add Cargo.lock
git commit --no-verify -m "set release version on CI build [ci skip]"
git tag "${{ github.event.inputs.version }}"
git push --atomic origin main "${{ github.event.inputs.version }}"
- name: Create Github Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "${{ github.event.inputs.version }}" --generate-notes
- name: Publish on crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Build binary artifact
uses: ./.github/workflows/artifacts.yml
with:
version: ${{ github.event.inputs.version }}