Initial code import with CI, publish and examples #2
Workflow file for this run
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
name: Release and Publish | |
on: | |
pull_request: | |
branches: | |
- main | |
- "release/[0-9]+.[0-9]+" | |
push: | |
branches: | |
- 'main' | |
- 'release/[0-9]+.[0-9]+' | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "✏️ Generate release changelog" | |
uses: heinrichreimer/github-changelog-generator-action@v2.3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
cargo-publish: | |
name: Cargo publish | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Determine which flags to use on cargo publish | |
id: cargo_flags | |
run: | | |
set -x | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
if [ "${BRANCH_NAME}" == "main" ]; then | |
echo "dry_run=false" >> $GITHUB_OUTPUT | |
echo "fail_if_version_published=false" >> $GITHUB_OUTPUT | |
elif [[ "${BRANCH_NAME}" == release/* ]]; then | |
echo "dry_run=false" >> $GITHUB_OUTPUT | |
echo "fail_if_version_published=false" >> $GITHUB_OUTPUT | |
else | |
echo "dry_run=true" >> $GITHUB_OUTPUT | |
echo "fail_if_version_published=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Publish or validate | |
uses: ./.github/actions/publish-crate | |
with: | |
dry-run: ${{ steps.cargo_flags.outputs.dry_run }} | |
fail-if-version-published: ${{ steps.cargo_flags.outputs.fail_if_version_published }} | |
cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |