-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `ci` workflow will trigger the others appropriately, depending whether it is a release (semver tag), or a pull request or a push to master
- Loading branch information
Showing
3 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v*.*.* | ||
|
||
jobs: | ||
check: | ||
uses: ./.github/workflows/check.yml | ||
|
||
publish: | ||
uses: ./.github/workflows/publish.yml | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
needs: check | ||
with: | ||
version: ${{ github.ref_name }} | ||
secrets: | ||
crates-io-token: ${{ secrets.CRATES_IO_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish | ||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: 'Semver of the version to publish' | ||
type: string | ||
required: true | ||
secrets: | ||
crates-io-token: | ||
description: 'Token for publishing to crates.io' | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rust:latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: check manifest version | ||
run: | | ||
version=$(grep -oP '(?<=^version = ").*(?="$)' Cargo.toml) | ||
if [ "$version" != "${{ inputs.version }}" ]; then | ||
echo "Version mismatch: Cargo.toml version is $version, but workflow input version is ${{ inputs.version }}" | ||
exit 1 | ||
fi | ||
- run: cargo publish --token ${{ secrets.crates-io-token }} --dry-run |