-
-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (132 loc) · 4.3 KB
/
Copy pathbump-n-release.yml
File metadata and controls
139 lines (132 loc) · 4.3 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
129
130
131
132
133
134
135
136
137
138
139
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-tools-manager
component:
description: The version component to increase
type: choice
required: true
default: patch
options:
- major
- minor
- patch
- rc
run-name: >-
${{ inputs.package && 'Deploy ' || 'Show Unreleased Changes' }}
${{ inputs.package || '' }}
permissions: {}
jobs:
bump-release:
if: github.event_name == 'workflow_dispatch'
name: Bump ${{ inputs.component }} version of ${{ inputs.package }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
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.3.0
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@732870f031d2fb36309d0deaf36abcc704a7be65 # v1.20.1
- run: cargo binstall -y git-cliff
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install cargo-edit
run: >-
cargo install cargo-edit
--locked
--no-default-features
--features set-version
- name: Install nushell
uses: hustcer/setup-nu@ccd5bb5426b05a32009c2ba967946231f3919c97 # v3.25
- 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.get-pkgs.outputs.pkgs }}
steps:
- uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Install nushell
uses: hustcer/setup-nu@ccd5bb5426b05a32009c2ba967946231f3919c97 # v3.25
- name: Get changed packages
id: get-pkgs
shell: nu {0}
run: |-
print (pwd)
use ("./.github/workflows/bump-n-release.nu" | path expand) get-changed-pkgs
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@v7.0.0
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- uses: cargo-bins/cargo-binstall@732870f031d2fb36309d0deaf36abcc704a7be65 # v1.20.1
- run: cargo binstall -y git-cliff
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nushell
uses: hustcer/setup-nu@ccd5bb5426b05a32009c2ba967946231f3919c97 # v3.25
- 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: |-
use ("./.github/workflows/bump-n-release.nu" | path expand) gen-changes
gen-changes $env.PKG --unreleased
let out = open --raw .config/ReleaseNotes.md
$"## ($env.PKG)\n\n($out)" | save --append $env.GITHUB_STEP_SUMMARY