-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (56 loc) · 1.94 KB
/
safe-api-plugin-cd.yaml
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
name: safe-api-plugin-cd
on:
pull_request:
types: [closed]
branches:
- main
jobs:
cd:
name: safe-api-plugin-cd
if: |
github.event.pull_request.merged &&
endsWith(github.event.pull_request.title, '/workflows/cd') != true &&
github.event.pull_request.user.login != 'github-actions'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Read VERSION into env.RELEASE_VERSION
run: |
echo RELEASE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g') >> $GITHUB_ENV
- name: Is Pre-Release
run: |
STR="${RELEASE_VERSION}"
SUB='pre.'
if [[ "$STR" == *"$SUB"* ]]; then
echo PRE_RELEASE=true >> $GITHUB_ENV
else
echo PRE_RELEASE=false >> $GITHUB_ENV
fi
- name: Setup Node.js
uses: actions/setup-node@master
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Install dependencies
run: yarn install --nonInteractive --frozen-lockfile --prefer-offline
- name: Build
run: yarn build
- name: Auth into NPM
run: |
npm config set registry https://registry.npmjs.org/
npm config set //registry.npmjs.org/:_authToken=${{secrets.POLYWRAP_BUILD_BOT_NPM_PAT}}
echo $(npm whoami --registry https://registry.npmjs.org/)
- name: Publish To NPM (Latest)
if: env.PRE_RELEASE == 'false'
run: yarn publish:npm
env:
NPM_AUTH_TOKEN: ${{secrets.POLYWRAP_BUILD_BOT_NPM_PAT}}
- name: Publish Node Packages To NPM (Pre-Release)
if: env.PRE_RELEASE == 'true'
run: yarn publish:pre:npm
env:
NPM_AUTH_TOKEN: ${{secrets.POLYWRAP_BUILD_BOT_NPM_PAT}}