-
Notifications
You must be signed in to change notification settings - Fork 35
97 lines (88 loc) · 3.33 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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:
# https://github.com/orgs/community/discussions/25305#discussioncomment-8256560
# 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: actions/create-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@v4
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
# 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 }}