Skip to content

Commit 06fd10a

Browse files
authored
chore: add automated pre-release process (#214)
1 parent de11cf3 commit 06fd10a

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/pre-release.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: prerelease
2+
on:
3+
push:
4+
branches:
5+
# releases/<tag>/<version>
6+
- releases/*/*
7+
jobs:
8+
prerelease:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: '*'
15+
cache: 'npm'
16+
check-latest: true
17+
registry-url: 'https://registry.npmjs.org'
18+
- name: Extract tag and version
19+
id: extract
20+
run: |-
21+
ref=${{ github.ref }}
22+
branch=${ref:11}
23+
tag_version=${branch:9}
24+
tag=${tag_version%/*}
25+
version=${tag_version##*/}
26+
echo "::set-output name=tag::${tag}"
27+
echo "::set-output name=version::${version}"
28+
- name: Log versions
29+
run: |-
30+
echo tag=${{ steps.extract.outputs.tag }}
31+
echo version=${{ steps.extract.outputs.version }}
32+
- name: Setup git user
33+
run: git config --global user.name github-actions
34+
- name: Setup git email
35+
run: git config --global user.email github-actions@github.com
36+
- name: Run npm version
37+
run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }}
38+
- name: Push changes
39+
run: git push --follow-tags
40+
- name: Run npm publish
41+
run: npm publish --tag=${{ steps.extract.outputs.tag }}
42+
env:
43+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

CONTRIBUTING.md

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ npm test
3636

3737
After submitting the pull request, please make sure the Continuous Integration checks are passing.
3838

39+
### Creating a prerelease
40+
41+
1. Create a branch named `releases/<tag>/<version>` with the version you'd like to release.
42+
2. Push the branch to the repo.
43+
44+
For example, a branch named `releases/rc/4.0.0` will create the version `v4.0.0-rc` and publish it under the `rc` tag.
45+
3946
## Releasing
4047

4148
Merge the release PR

0 commit comments

Comments
 (0)