ci: add pushing of test empty commit before release #66
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 | ||
<<<<<<< HEAD | ||
uses: actions/create-github-app-token@v1 | ||
======= | ||
uses: tibdex/github-app-token@v2 | ||
>>>>>>> 4458d58ebf7 (ci: add pushing of test empty commit before release) | ||
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@v4 | ||
with: | ||
# Fetch all commit history so smart-release can generate changelogs. | ||
fetch-depth: 0 | ||
token: ${{ steps.generate_token.outputs.token }} | ||
- name: Push test commit | ||
run: | | ||
git commit -m 'pre-release test commit' --allow-empty | ||
git push | ||
- 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 | ||
# list lockstep-versioned packages at the end of this command | ||
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 hydroflow_lang hydroflow_macro hydroflow_plus | ||
hydroflow_datalog hydroflow_datalog_core | ||
hydro_deploy hydro_cli hydroflow_cli_integration | ||
hydroflow_plus_cli_integration | ||
stageleft stageleft_macro stageleft_tool | ||
multiplatform_test | ||
env: | ||
# Make sure to set this so the `gh` CLI works using our token. | ||
GH_TOKEN: ${{ steps.generate_token.outputs.token }} |