-
Notifications
You must be signed in to change notification settings - Fork 12
92 lines (80 loc) · 3.2 KB
/
release.yml
File metadata and controls
92 lines (80 loc) · 3.2 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
name: Release
on:
workflow_dispatch:
inputs:
update_type:
description: Update type
required: true
type: choice
options:
- patch
- minor
- major
permissions: read-all
jobs:
initiate:
name: Initiate
runs-on: ubuntu-24.04
permissions:
contents: write # To push a commit
pull-requests: write # To open a Pull Request
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Verify action checksums
uses: ./.github/actions/ghasum
- name: Install Node.js
uses: actions/setup-node@v6.3.0
with:
cache: npm
node-version-file: .nvmrc
- name: Install dependencies
run: npm clean-install
- name: Create automation token
uses: actions/create-github-app-token@v3.1.1
id: automation-token
with:
client-id: ${{ secrets.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
- name: Bump version
env:
UPDATE_TYPE: ${{ github.event.inputs.update_type }}
run: npm version "$UPDATE_TYPE" --no-git-tag-version
- name: Update src/index.js
run: node script/release/bump-jsdoc.js
- name: Update CHANGELOG
run: node script/release/bump-changelog.js
- name: Create Pull Request
env:
GH_TOKEN: ${{ steps.automation-token.outputs.token }}
REPOSITORY: ${{ github.repository }}
UPDATE_TYPE: ${{ github.event.inputs.update_type }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -B "release-${UPDATE_TYPE}"
git add 'CHANGELOG.md' 'src/index.js' 'package.json' 'package-lock.json'
git commit --message 'Version bump'
git remote set-url 'origin' "https://x-access-token:${GH_TOKEN}@github.com/${REPOSITORY}"
git push --force 'origin' "release-${UPDATE_TYPE}"
gh pr create \
--base='main' --head="release-${UPDATE_TYPE}" \
--title="New ${UPDATE_TYPE} release" \
--body='_This Pull Request was created automatically_
---
### Merge checklist
- [ ] All continuous integration checks passed.
- [ ] The version number is consistently updated in `package.json`, `package-lock.json`, and `src/index.js`.
- [ ] A new release is added to `CHANGELOG.md` with the correct version number and date.
- [ ] The new version number is in accordance with [Semantic Versioning].
- [ ] There are no unexpected changes in the Pull Request.
### Post-merge checklist
_It will take a few minutes for this to happen._
- [ ] The new version is published to [npm].
- [ ] A git tag for the new release is created.
- [ ] A GitHub release is created.
- [ ] The major version branch is updated.
[npm]: https://www.npmjs.com/package/shescape
[semantic versioning]: https://semver.org/spec/v2.0.0.html'