name: Check Release
on:
push:
branches:
- 'r/[0-9]+.[0-9]+.[0-9]+'
- 'r/[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+'
jobs:
check-version:
name: check-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get the release version from the branch
if: env.VERSION == ''
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION##r/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
outputs:
version: ${{ env.VERSION }}
check-release:
name: check-release
needs: ['check-version']
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-latest
- build: macos
os: macos-latest
- build: windows
os: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build library
shell: bash
run: |
cargo build --verbose --release
check-publication:
name: Check cargo publication
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --dry-run