Release #35
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
bump: | |
description: "Specify how to bump the version for `hydroflow` crates. Does not affect dependencies." | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
- keep | |
- auto | |
execute: | |
description: "Actually execute and publish the release?" | |
required: true | |
type: boolean | |
default: false | |
jobs: | |
release_job: | |
name: Release Job | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
steps: | |
# Unfortunately branch protection means that this workflow can't push the updated changelogs | |
# and tags to `main` in the normal way. Instead we have an app: | |
# https://github.com/organizations/hydro-project/settings/apps/hydro-project-bot | |
# Which is added the the users allowed to bypass branch protections: | |
# https://github.com/hydro-project/hydroflow/settings/branches | |
# We grab a token from the app using this action via the `APP_ID` ("App ID") and an | |
# `APP_PRIVATE_KEY` ("Generate a private key"). | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- run: | | |
echo "Version bump: $BUMP" | |
echo "Execute: $EXECUTE" | |
env: | |
BUMP: ${{ inputs.bump }} | |
EXECUTE: ${{ inputs.execute }} | |
# https://api.github.com/users/hydro-project-bot[bot] | |
- name: Configure git | |
run: | | |
git config --global user.name "hydro-project-bot[bot]" | |
git config --global user.email "132423234+hydro-project-bot[bot]@users.noreply.github.com" | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
# Fetch all commit history so smart-release can generate changelogs. | |
fetch-depth: 0 | |
token: ${{ steps.generate_token.outputs.token }} | |
- name: Install nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
- name: Run cargo login | |
uses: actions-rs/cargo@v1 | |
with: | |
command: login | |
args: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- name: Install cargo-smart-release | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-smart-release | |
- name: Run cargo smart-release | |
run: >- | |
cargo smart-release --update-crates-index | |
--no-changelog-preview --allow-fully-generated-changelogs | |
--bump ${{ inputs.bump }} --bump-dependencies auto | |
${{ inputs.execute && '--execute' || '--no-publish' }} | |
hydroflow hydro_cli hydroflow_* | |
env: | |
# Make sure to set this so the `gh` CLI works using our token. | |
GH_TOKEN: ${{ steps.generate_token.outputs.token }} |