Skip to content

Commit b527cf9

Browse files
authored
chore(ci): prelease action (#244)
1 parent 4005f16 commit b527cf9

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/pre-release.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
check-latest: true
16+
registry-url: 'https://registry.npmjs.org'
17+
- name: Extract tag and version
18+
id: extract
19+
run: |-
20+
ref=${{ github.ref }}
21+
branch=${ref:11}
22+
tag_version=${branch:9}
23+
tag=${tag_version%/*}
24+
version=${tag_version##*/}
25+
echo "::set-output name=tag::${tag}"
26+
echo "::set-output name=version::${version}"
27+
- name: Log versions
28+
run: |-
29+
echo tag=${{ steps.extract.outputs.tag }}
30+
echo version=${{ steps.extract.outputs.version }}
31+
- name: Setup git user
32+
run: git config --global user.name github-actions
33+
- name: Setup git email
34+
run: git config --global user.email [email protected]
35+
- name: Run npm version
36+
run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }}
37+
- name: Push changes
38+
run: git push --follow-tags
39+
- name: Run npm publish
40+
run: npm publish --tag=${{ steps.extract.outputs.tag }}
41+
env:
42+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

CONTRIBUTING.md

+7
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ After submitting the pull request, please make sure the Continuous Integration c
3939
## Releasing
4040

4141
1. Merge the release PR
42+
43+
### Creating a prerelease
44+
45+
1. Create a branch named `releases/<tag>/<version>` with the version you'd like to release.
46+
2. Push the branch to the repo.
47+
48+
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.

0 commit comments

Comments
 (0)