-
Notifications
You must be signed in to change notification settings - Fork 37
111 lines (105 loc) · 3.53 KB
/
node.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.20.0]
steps:
- uses: actions/checkout@v2
- name: Install and run lint
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.20.0]
test-script: ["ci:test-unit", "ci:test-e2e-layouts","ci:test-e2e-styleParams", "ci:test-e2e-integration"]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Install, build and run test
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run ${{ matrix.test-script }}
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
TEST_NAME: ${{ matrix.test-script }}
deploy:
runs-on: ubuntu-latest
needs: [lint, tests]
strategy:
matrix:
node-version: [16.20.0]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Install, build, configure git and lerna publish
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build --if-present
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "GitHub Actions"
- run: git remote set-url origin https://[email protected]/wix/pro-gallery
- run: |
echo "registry=http://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push to master
if: github.event_name == 'push'
# run: echo "this is a push to master"
run: |
git checkout master
lerna publish patch --exact --yes --registry https://registry.npmjs.org
npm run changelog
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push to pull request
if: github.event_name == 'pull_request' && github.actor != 'dependabot'
# run: echo "PULL REQUEST PUSH"
run: lerna publish --canary --preid ${{ github.sha }} --yes --registry https://registry.npmjs.org
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
update-playground:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [lint, tests]
strategy:
matrix:
node-version: [16.20.0]
steps:
- uses: actions/checkout@v2
- name: update-playground
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build --if-present
- run: node scripts/deployToSurge
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}