chore: bump versions in preparation for release #2
Workflow file for this run
This file contains hidden or 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: Trouble Host Release | |
on: | |
push: | |
tags: | |
- 'trouble-host-v[0-9]+.[0-9]+.[0-9]+' | |
permissions: | |
contents: write | |
jobs: | |
# Re Run the Checks | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends libudev-dev | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: true | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target_ci/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: CI | |
run: | | |
./ci.sh | |
release_trouble_host: | |
# Only run if the checks pass | |
name: Publish Trouble Host | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Verify Version | |
run: | | |
TAG_VERSION=${GITHUB_REF#refs/tags/trouble-host-v} | |
CARGO_VERSION=$(grep '^version =' host/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/') | |
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then | |
echo "Version mismatch: tag is $TAG_VERSION but Cargo.toml is $CARGO_VERSION" | |
exit 1 # Exits with a non-zero status to fail the workflow | |
fi | |
shell: bash | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Build project | |
run: | | |
cd host | |
cargo build --release | |
- name: Create GitHub release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} host v${tag#trouble-host-v}" \ | |
--generate-notes | |
- name: Publish to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
# Publish to the main registry | |
run: | | |
echo "Publishing to crates.io" | |
cargo publish | |
# To perform a dry run uncomment the following lines | |
# run: | | |
# echo "Performing dry-run publish to crates.io" | |
# cd host | |
# cargo publish --dry-run |