-
-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (123 loc) · 3.97 KB
/
bump-n-release.yml
File metadata and controls
128 lines (123 loc) · 3.97 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Bump-n-Release
# NOTE: The change log is only updated in the remote upon release (in `bump-release` job)
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:
inputs:
package:
description: The package to release
type: choice
required: true
default: cpp-linter
options:
- cpp-linter
- cpp-linter-js
- cpp-linter-py
- clang-installer
component:
description: The version component to increase
type: choice
required: true
default: patch
options:
- major
- minor
- patch
- rc
permissions: {}
jobs:
bump-release:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.BUMP_N_RELEASE }}
fetch-depth: 0
fetch-tags: true
persist-credentials: true # needed for `git push`
- name: Set up Python
if: inputs.package == 'cpp-linter-py'
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Install Node.js
if: inputs.package == 'cpp-linter-js'
uses: actions/setup-node@v6
with:
node-version: 24.x
- run: yarn install
if: inputs.package == 'cpp-linter-js'
- uses: cargo-bins/cargo-binstall@f8ce4d55b131f4a1e373b8747ca6b6a54133ae5a # v1.18.0
- run: cargo binstall -y git-cliff
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nushell
uses: hustcer/setup-nu@92c296ba1ba2ba04cc948ab64ddefe192dc13f0c # v3.23
- name: Bump ${{ inputs.component }} version
env:
GITHUB_TOKEN: ${{ secrets.BUMP_N_RELEASE }}
GH_TOKEN: ${{ secrets.BUMP_N_RELEASE }}
run: nu .github/workflows/bump-n-release.nu ${{ inputs.package }} ${{ inputs.component }}
id: tagged
get-changed-pkgs:
if: github.event_name != 'workflow_dispatch' && !startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
outputs:
pkgs: ${{ steps.set-pkgs.outputs.pkgs }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Install nushell
uses: hustcer/setup-nu@92c296ba1ba2ba04cc948ab64ddefe192dc13f0c # v3.23
- name: Get changed packages
id: set-pkgs
shell: nu {0}
run: |-
cd ${{ github.workspace }}
source ${{ github.workspace }}/.github/workflows/bump-n-release.nu
let pkgs = get-changed-pkgs
"pkgs=($pkgs)\n" | save --append $env.GITHUB_OUTPUT
update-changelog:
if: github.event_name != 'workflow_dispatch'
needs: get-changed-pkgs
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
strategy:
matrix:
pkg: ${{ fromJSON(needs.get-changed-pkgs.outputs.pkgs) }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- uses: cargo-bins/cargo-binstall@f8ce4d55b131f4a1e373b8747ca6b6a54133ae5a # v1.18.0
- run: cargo binstall -y git-cliff
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nushell
uses: hustcer/setup-nu@92c296ba1ba2ba04cc948ab64ddefe192dc13f0c # v3.23
- name: Generate a release notes
env:
PKG: ${{ matrix.pkg }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPO: ${{ github.repository }}
GIT_CLIFF_CONFIG: .config/cliff.toml
shell: nu {0}
run: |-
cd ${{ github.workspace }}
source ${{ github.workspace }}.github/workflows/bump-n-release.nu
gen-changes $env.PKG --unreleased
let out = open --raw .config/ReleaseNotes.md
$"## ($env.PKG)\n\n($out)" | save --append $env.GITHUB_STEP_SUMMARY