Skip to content

hotfix: remove serde feature on SignerError #32

hotfix: remove serde feature on SignerError

hotfix: remove serde feature on SignerError #32

Workflow file for this run

name: "Release"
on:
push:
tags:
- "*.*.*"
jobs:
release-info:
name: "Extract release info"
runs-on: ubuntu-latest
outputs:
crate: ${{ steps.parse.outputs.crate }}
version: ${{ steps.parse.outputs.version }}
tag: ${{ github.ref_name }}
steps:
- name: "Checkout source code"
uses: actions/checkout@v4
- id: parse
name: "Get version from tag and crate name from root Cargo.toml"
run: |
VERSION_TAG="${{ github.ref_name }}"
echo "Tag (version) detected: $VERSION_TAG"
CARGO_TOML_PATH="Cargo.toml"
if [ ! -f "$CARGO_TOML_PATH" ]; then
echo "Error: Root $CARGO_TOML_PATH not found."
exit 1
fi
CRATE_NAME=$(grep '^name = "' "$CARGO_TOML_PATH" | sed -E 's/name = "(.*)"/\1/')
if [[ -z "$CRATE_NAME" ]]; then
echo "Error: Could not parse crate name from $CARGO_TOML_PATH."
exit 1
fi
echo "Derived crate name: $CRATE_NAME"
echo "crate=$CRATE_NAME" >> $GITHUB_OUTPUT
echo "version=$VERSION_TAG" >> $GITHUB_OUTPUT
commit-branch-check:
name: "Check commit branch"
runs-on: ubuntu-latest
needs: [release-info]
steps:
- name: "Checkout source code (full history)"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Check if commit is on default branch"
run: |
COMMIT_HASH=$(git rev-parse ${{ needs.release-info.outputs.tag }})
DEFAULT_BRANCH="${{ github.event.repository.default_branch }}"
echo "Checking if commit $COMMIT_HASH (tag ${{ needs.release-info.outputs.tag }}) is on branch origin/$DEFAULT_BRANCH"
if git branch -r --contains "$COMMIT_HASH" | grep -q "origin/$DEFAULT_BRANCH"; then
echo "Commit found on origin/$DEFAULT_BRANCH."
else
echo "Error: Cannot release commit $COMMIT_HASH because it is not on the default branch (origin/$DEFAULT_BRANCH)."
exit 1
fi
crate-version-check:
name: "Check crate version"
runs-on: ubuntu-latest
needs: [release-info]
steps:
- name: "Checkout source code"
uses: actions/checkout@v4
- name: "Check version in root Cargo.toml"
run: |
EXPECTED_VERSION="${{ needs.release-info.outputs.version }}"
CARGO_TOML_PATH="Cargo.toml"
if [ ! -f "$CARGO_TOML_PATH" ]; then
echo "Error: $CARGO_TOML_PATH not found."
exit 1
fi
echo "Checking for version = \"$EXPECTED_VERSION\" in $CARGO_TOML_PATH"
if grep -q "^version = \"${EXPECTED_VERSION}\"" "$CARGO_TOML_PATH"; then
echo "Version $EXPECTED_VERSION found in $CARGO_TOML_PATH."
else
echo "Error: Version mismatch in $CARGO_TOML_PATH."
echo "Expected: version = \"$EXPECTED_VERSION\" based on tag."
echo "Found:"
grep "^version = " "$CARGO_TOML_PATH" || echo "No 'version =' line found."
exit 1
fi
build:
name: "Build for ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs: [release-info]
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: "Checkout source code"
uses: actions/checkout@v4
- name: Install Cap'n Proto (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y capnproto libcapnp-dev
- name: Install Cap'n Proto (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install capnp
- name: Install Cap'n Proto (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install -y capnproto
shell: powershell
- name: "Install Rust stable toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry, index and build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ needs.release-info.outputs.crate }}-${{ hashFiles('**/Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ needs.release-info.outputs.crate }}-
- name: "Build crate"
run: cargo build --package ${{ needs.release-info.outputs.crate }} --all-targets --verbose
env:
CARGO_TERM_COLOR: always
crates-io-release:
name: "Release to crates.io"
runs-on: ubuntu-latest
needs:
- release-info
- commit-branch-check
- crate-version-check
- build
steps:
- name: "Checkout source code"
uses: actions/checkout@v4
- name: "Install Rust stable toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Install Cap'n Proto"
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y capnproto libcapnp-dev
- name: "Login to crates.io"
run: cargo login $CRATES_IO_API_TOKEN
env:
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
- name: "Publish crate to crates.io"
run: |
cargo publish --package ${{ needs.release-info.outputs.crate }} --allow-dirty