-
Notifications
You must be signed in to change notification settings - Fork 43
59 lines (48 loc) · 1.49 KB
/
release.yml
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
name: Release
on:
push:
tags:
- '**'
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get tag name
id: get_tag_name
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
- name: Checkout branch
env:
TAG_NAME: ${{ steps.get_tag_name.outputs.TAG_NAME }}
run: git checkout tags/${TAG_NAME} -b ${TAG_NAME}-branch
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 14.x
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Add auth token
run: |
cat <<EOT >> .npmrc
//registry.npmjs.org/:_authToken=\${NPM_PUBLISH_TOKEN}
always-auth=true
EOT
- name: Release
env:
TAG_NAME: ${{ steps.get_tag_name.outputs.TAG_NAME }}
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
if [[ "$TAG_NAME" == *"alpha"* ]]; then
dist_tag=alpha${TAG_NAME:1:1}
elif [[ "$TAG_NAME" == *"beta"* ]]; then
dist_tag=beta${TAG_NAME:1:1}
else
dist_tag=latest
fi
yarn release -- $TAG_NAME --tag=${dist_tag} --branch ${TAG_NAME}-branch