Skip to content

Commit 1180322

Browse files
ci: add workflows and configuration for labeler and release drafter (#2)
1 parent 447c2d2 commit 1180322

6 files changed

Lines changed: 149 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ version: 2
22
updates:
33
- package-ecosystem: github-actions
44
directory: /
5+
labels:
6+
- 'maintenance'
57
schedule:
68
interval: weekly
79
groups:
@@ -12,6 +14,8 @@ updates:
1214

1315
- package-ecosystem: npm
1416
directory: /
17+
labels:
18+
- 'maintenance'
1519
schedule:
1620
interval: weekly
1721
ignore:

.github/labeler.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Configuration for GitHub Actions labeler v5
2+
# See: https://github.com/actions/labeler
3+
4+
documentation:
5+
- changed-files:
6+
- any-glob-to-any-file: ['**/*.md']
7+
8+
maintenance:
9+
- changed-files:
10+
- any-glob-to-any-file:
11+
['.github/**/*', 'package.json', 'package-lock.json']
12+
13+
enhancement:
14+
- changed-files:
15+
- any-glob-to-any-file: ['src/**/*', 'dist/**/*', 'action.yml']

.github/release-drafter.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features and Improvements'
5+
labels:
6+
- 'enhancement'
7+
- title: '🐛 Bug Fixes'
8+
labels:
9+
- 'bug'
10+
- title: '🧰 Maintenance'
11+
labels:
12+
- 'maintenance'
13+
- title: '📚 Documentation'
14+
labels:
15+
- 'documentation'
16+
change-template: '- $TITLE (#$NUMBER)'
17+
version-resolver:
18+
major:
19+
labels:
20+
- 'bump-major'
21+
- 'breaking'
22+
minor:
23+
labels:
24+
- 'bump-minor'
25+
- 'enhancement'
26+
default: patch
27+
template: |
28+
## What's Changed
29+
$CHANGES
30+
31+
exclude-labels:
32+
- 'skip-release-notes'

.github/workflows/labeler.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pull Request Labeler
2+
on:
3+
pull_request_target:
4+
types: [opened, synchronize, reopened]
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
10+
jobs:
11+
label:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
steps:
17+
- uses: actions/labeler@v5
18+
with:
19+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
20+
sync-labels: true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write # to create a github release
11+
pull-requests: read
12+
13+
jobs:
14+
update_release_draft:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Update Release Draft
21+
uses: release-drafter/release-drafter@v6
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update Release Tags
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update-version-tags:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Determine version tag numbers
18+
id: extract_version_tags
19+
run: |
20+
echo "Determining major and minor tag numbers for:"
21+
echo "${{ github.sha }} ${{ github.ref }} "
22+
tag="${GITHUB_REF#refs/tags/v}"
23+
minor_version="${tag%.*}"
24+
major_version="${tag%%.*}"
25+
echo "minor_version=v$minor_version" >> "$GITHUB_OUTPUT"
26+
echo "major_version=v$major_version" >> "$GITHUB_OUTPUT"
27+
28+
- name: Create tags locally
29+
run: |
30+
git tag "${{ steps.extract_version_tags.outputs.minor_version }}" -f
31+
echo "Created minor release tag: ${{ steps.extract_version_tags.outputs.minor_version }}"
32+
git tag "${{ steps.extract_version_tags.outputs.major_version }}" -f
33+
echo "Created major release tag: ${{ steps.extract_version_tags.outputs.major_version }}"
34+
35+
- name: Check tag hashes match original sha
36+
run: |
37+
minor_sha=$(git rev-parse "${{ steps.extract_version_tags.outputs.minor_version }}")
38+
major_sha=$(git rev-parse "${{ steps.extract_version_tags.outputs.major_version }}")
39+
if [ "$minor_sha" != "${{ github.sha }}" ]; then
40+
echo "Minor tag does not match original sha"
41+
exit 1
42+
fi
43+
if [ "$major_sha" != "${{ github.sha }}" ]; then
44+
echo "Minor tag does not match original sha"
45+
exit 1
46+
fi
47+
echo "Tag hashes verified."
48+
49+
- name: Force push tags to remote
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
git push origin "${{ steps.extract_version_tags.outputs.minor_version }}" -f
54+
git push origin "${{ steps.extract_version_tags.outputs.major_version }}" -f
55+
echo "Pushed tags to origin"

0 commit comments

Comments
 (0)