-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (55 loc) · 1.78 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
name: Release Workflow
on:
# Triggers the workflow after the Test Workflow has completed
workflow_run:
workflows: ['Test Workflow']
types:
- completed
branches:
- master
- next
- 'release/*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: false
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment: 'Release NPM'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
RELEASE_BRANCH: ${{ github.event.workflow_run.head_branch }}
steps:
- uses: actions/setup-node@v2
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ env.GITHUB_TOKEN }}
ref: ${{ env.RELEASE_BRANCH }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: npm-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-node-
- name: Auth NPM
run: echo "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}" > ~/.npmrc
- name: Install Deps
run: npm ci --ignore-scripts
- name: Release Latest
if: ${{ env.RELEASE_BRANCH == 'master' }}
run: npm run release
- name: Release Next
if: ${{ env.RELEASE_BRANCH == 'next' }}
run: RELEASE_TAG=next npm run release:tag
- name: Release Branch
if: ${{ startsWith(env.RELEASE_BRANCH, 'release/') }}
run: RELEASE_BRANCH=\"${{ env.RELEASE_BRANCH }}\" npm run release:branch
- name: Release Error Log
if: failure()
run: cat lerna-debug.log