-
Notifications
You must be signed in to change notification settings - Fork 6
93 lines (89 loc) · 2.62 KB
/
actions.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: SDK CI-CD
on:
push:
branches:
- release/MessagingAPI-V3-SDK
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up node
uses: actions/[email protected]
with:
node-version: 14.x
- name: cache node_modules
id: cache-node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
- name: install dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm install
shell: bash
- name: run tests
run: |
npm run test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up node
uses: actions/[email protected]
with:
node-version: 14.x
- name: cache node_modules
id: cache-node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
- name: install dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm install
shell: bash
- name: run linting
run: |
npm run lint
publish:
runs-on: ubuntu-latest
needs:
- test
- lint
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: cache node_modules
id: cache-node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
- name: install dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm install
shell: bash
- name: create .npmrc
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true' > .npmrc
- name: publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
PUBLISHED_VERSION=$(npm view "@telstra/messaging" dist-tags.latest)
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
[[ "$PUBLISHED_VERSION" == "$PACKAGE_VERSION" ]] || npm publish --access public
- name: upload artifacts that were released
uses: actions/upload-artifact@v2
with:
name: sdk
path: dist/