Skip to content

Release

Release #1

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
bumpLevel:
description: 'Version Bump Level'
required: true
default: 'patch'
type: choice
options:
- none
- major
- minor
- patch
dryRun:
description: 'Dry Run mode'
required: true
type: boolean
env:
CARGO_TERM_COLOR: always
jobs:
verify_build:
name: Verify build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Ensure branch is 'main'
run: |
git fetch origin &> /dev/null
branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${branch}" != "main" ]]; then
echo "The release branch must be main. Got '${branch}'' instead." >&2
exit 1
else
echo "Branch is '${branch}'"
fi
- name: Build
run: cargo build --verbose --all-features --all
- name: Run tests
run: cargo test --verbose --all-features --all
- name: Run clippy
run: cargo clippy --verbose --all-features --all -- -D warnings
bump_version:
if: ${{ inputs.bumpLevel !== none }}

Check failure on line 48 in .github/workflows/release.yaml

View workflow run for this annotation

GitHub Actions / Release

Invalid workflow file

The workflow is not valid. .github/workflows/release.yaml (Line: 48, Col: 9): Unexpected symbol: '='. Located at position 20 within expression: inputs.bumpLevel !== none
name: Bump version
runs-on: ubuntu-latest
needs: verify_build
outputs:
version: ${{ steps.check_version.outputs.version }}
tag: ${{ steps.check_version.outputs.tag }}
commit: ${{ steps.check_version.outputs.commit }}
steps:
- uses: actions/checkout@v3
- run: |
echo "Bumping to level: $BUMP_LEVEL"
env:
BUMP_LEVEL: ${{ inputs.bumpLevel }}
- name: Install python requirements
run: |
echo "PWD: ${PWD}" && ls && pip3 install -r requirements.txt
- name: Bump appropriate version
run: python3 new_version.py ${{ inputs.bumpLevel }}
- name: Show diff
run: git diff
- name: Compute version and ensure release does not already exist
id: check_version
run: |
VERSION=$(tq -f Cargo.toml .package.version | sed 's/^.\(.*\).$/\1/')
TAG="v${VERSION}"
COMMIT=$(git rev-parse HEAD)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
git fetch origin &> /dev/null
if [[ -n "$(git tag -l ${TAG})" ]]; then
echo "A release '${TAG}' already exists." >&2
exit 1
else
echo "Tag '${TAG}' will be created on successful deploy"
fi
- name: Configure git
run: |
git config --global user.name 'Ricardo Delfin'
git config --global user.email '[email protected]'
- name: Commit version
run: |
git commit -am "${{ inputs.bumpLevel }} version bump"
- name: Push new version
run: |
git push
publish-crates:
name: Publish crates.io
runs-on: ubuntu-latest
needs: bump_version
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
args: --package flatbuffers-build
dry-run: ${{ inputs.dryRun }}
github_release:
name: Generate Github release
runs-on: ubuntu-latest
needs: [bump_version, docker_build]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.bump_version.outputs.commit }}
- name: Generate release notes
run: |
# Generate the release notes
sed 's/{version}/${{ env.VERSION }}/g' ${{ github.workspace }}/.github/release_notes.template \
> ${{ github.workspace }}/.github/release_notes.txt
env:
VERSION: ${{ needs.bump_version.outputs.version }}
- name: Create release
uses: softprops/action-gh-release@v1
id: rules_rust_release
env:
GIT_TAG: ${{ needs.bump_version.outputs.tag }}
COMMIT: ${{ needs.bump_version.outputs.commit }}
with:
generate_release_notes: true
tag_name: ${{ env.GIT_TAG }}
body_path: ${{ github.workspace }}/.github/release_notes.txt
target_commitish: ${{ env.COMMIT }}