Fix publish error in gel-derive (#497) #3
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
on: | |
push: | |
tags: | |
- releases/*/v* | |
name: Release gel-* crate | |
jobs: | |
test_and_publish: | |
name: Test and publish | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: "write" | |
contents: "read" | |
steps: | |
- name: checkout and env setup | |
uses: actions/checkout@v3 | |
- name: Extract project name and version | |
run: | | |
set -x | |
PROJECT_NAME=$(echo $GITHUB_REF | sed -E 's|refs/tags/releases/([^/]+)/v.*|\1|') | |
VERSION=$(echo $GITHUB_REF | sed -E 's|.*/v(.*)|\1|') | |
echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Verify git tag matches cargo version | |
run: | | |
set -x | |
cargo_version="$(cargo metadata --format-version 1 \ | |
| jq -r '.packages[] | select(.name=="${{ env.PROJECT_NAME }}") | .version')" | |
test "$cargo_version" = "${{ env.VERSION }}" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- working-directory: ./${{ env.PROJECT_NAME }} | |
run: | | |
cargo publish --token=${{ secrets.CARGO_REGISTRY_TOKEN }} |