-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (69 loc) · 2.28 KB
/
release.yml
File metadata and controls
77 lines (69 loc) · 2.28 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
name: Release hpke
permissions: {}
on:
push:
tags: ['v1.[0-9]+.[0-9]+']
jobs:
npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- run: npm publish
cleanup:
needs:
- npm
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- run: git push origin $GITHUB_SHA:v1.x
- run: git rm index.js index.d.ts index.d.ts.map
- run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "chore: cleanup after release"
- run: git push origin HEAD:main
github:
needs:
- npm
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 2
- name: Create GitHub Release
run: |
# Get the CHANGELOG.md content from the current commit
git show HEAD -- CHANGELOG.md > CHANGELOG.diff
# Get the tag name pointing at the current commit
tag=$(git tag --points-at HEAD)
# Extract release notes from the diff:
# 1. Select only lines starting with '+' (additions)
# 2. Exclude the '+++ b/CHANGELOG.md' header line
# 3. Remove the leading '+' from each line
# 4. Skip the first 3 lines (likely header/metadata)
sed -n '/^+/p' CHANGELOG.diff | \
grep -v '^+++' | \
sed 's/^+//' | \
tail -n +4 > notes.md
# Create a GitHub release with the extracted notes
gh release create "$tag" -F notes.md --title "$tag" --discussion-category Releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}