Skip to content

Commit 9c8bb7a

Browse files
authored
chore: Configure release automation (#5)
Configures release-please to run whenever a pull request is merged into the main branch, this will open or update a release pull request.
1 parent 81a2828 commit 9c8bb7a

File tree

7 files changed

+142
-1
lines changed

7 files changed

+142
-1
lines changed

.github/labeler.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"workflows 👷‍♀️":
2+
- changed-files:
3+
- any-glob-to-any-file: .github/**/*.yaml

.github/release-please-config.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"bump-minor-pre-major": true,
6+
"changelog-sections": [
7+
{
8+
"hidden": false,
9+
"section": "New features",
10+
"type": "feat"
11+
},
12+
{
13+
"hidden": false,
14+
"section": "Bug fixes",
15+
"type": "fix"
16+
},
17+
{
18+
"hidden": false,
19+
"section": "Miscellaneous",
20+
"type": "chore"
21+
}
22+
],
23+
"draft": false,
24+
"extra-label": "automata 🤖,autorelease: pending,chore 🧹",
25+
"include-v-in-tag": true,
26+
"initial-version": "1.0.0",
27+
"prerelease": false,
28+
"pull-request-header": "🤖 I have created a release",
29+
"pull-request-title-pattern": "chore: Release v${version}",
30+
"release-label": "automata 🤖,autorelease: tagged,chore 🧹",
31+
"release-type": "node"
32+
}
33+
}
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

.github/workflows/ci.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ on:
44
push:
55
branches:
66
- main
7+
paths-ignore:
8+
- .editorconfig
9+
- .gitignore
10+
- .prettierignore
11+
- action.yaml
12+
- CHANGELOG.md
13+
- LICENSE.md
14+
- README.md
715

816
jobs:
917
verify:
@@ -13,7 +21,7 @@ jobs:
1321
- name: Checkout code
1422
uses: actions/checkout@v4
1523
- name: Setup Node.js
16-
uses: actions/setup-node@v2
24+
uses: actions/setup-node@v4
1725
with:
1826
cache: npm
1927
cache-dependency-path: package-lock.json
@@ -60,3 +68,21 @@ jobs:
6068
- name: Show the Grafana Tanka version
6169
run: |
6270
tk.exe --version
71+
72+
release:
73+
name: Release?
74+
needs: [ dogfood-linux, dogfood-windows ]
75+
permissions:
76+
contents: write
77+
pull-requests: write
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v4
82+
- name: Prepare a release
83+
id: release
84+
uses: google-github-actions/release-please-action@v4
85+
with:
86+
config-file: .github/release-please-config.json
87+
manifest-file: .github/release-please-manifest.json
88+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- .editorconfig
9+
- .gitignore
10+
- .prettierignore
11+
- action.yaml
12+
- CHANGELOG.md
13+
- LICENSE.md
14+
- README.md
15+
16+
jobs:
17+
verify:
18+
name: Verify
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
cache: npm
27+
cache-dependency-path: package-lock.json
28+
node-version: 20.x
29+
- name: Install dependencies
30+
run: npm ci --no-fund
31+
- name: Check formatting
32+
run: npm run fmt:check
33+
- name: Run unit tests
34+
run: npm run test

.github/workflows/pr_label.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: PR / Label
2+
3+
on:
4+
pull_request_target: { }
5+
6+
jobs:
7+
triage:
8+
name: Triage
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Apply context labels
17+
uses: actions/labeler@v5
18+
with:
19+
configuration-path: .github/labeler.yaml
20+
sync-labels: true
21+
- name: Apply commit message labels
22+
uses: actions/github-script@v7
23+
with:
24+
script: |
25+
const labels = []
26+
if (context.payload.pull_request.title.startsWith('fix:')) {
27+
labels.push('bug 🐛')
28+
}
29+
if (context.payload.pull_request.title.startsWith('chore:')) {
30+
labels.push('chore 🧹')
31+
}
32+
if (context.payload.pull_request.title.startsWith('feat:')) {
33+
labels.push('feature 💡')
34+
}
35+
if (labels.length > 0) {
36+
github.rest.issues.addLabels({
37+
issue_number: context.issue.number,
38+
labels,
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
})
42+
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.yaml
22
CHANGELOG.md
3+
README.md
34
dist/
45
node_modules/

0 commit comments

Comments
 (0)