-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (167 loc) · 7.3 KB
/
dev-stg-build.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Build and deploy to DEV / STG
on:
push:
branches:
- main
jobs:
build-preflight:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PACKAGE_SECRET }}
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
scope: '@chili-publish'
- name: install dependencies
run: |
yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }}
- name: run license check
run: yarn validate-licenses
- name: run linting
run: yarn ci-lint
- name: run tests
run: yarn cover
- uses: actions/upload-artifact@v4
with:
name: coverage-artifact
path: coverage/coverage-summary.json
build-deploy-dev:
needs: build-preflight
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PACKAGE_SECRET }}
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
scope: '@chili-publish'
- name: install dependencies
run: |
yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }}
- name: build code
run: yarn build
- name: copy file branch
run: |
export CURRENT_PACKAGE_VERSION=$(node --eval="var pjson = require('./package.json');console.log(pjson.version);")
export PACKAGE_VERSION_TRIMMED=$(node --eval="const version = '$CURRENT_PACKAGE_VERSION'.split('.'); const path = version[0] + '.' + version[1]; console.log(path)")
export PACKAGE_VERSION_PATCH=$(node --eval="const version = '$CURRENT_PACKAGE_VERSION'.split('.');console.log(version[2])")
buildPath=upload/$PACKAGE_VERSION_TRIMMED/$PACKAGE_VERSION_PATCH
latestPath=upload/latest
versionedLatestPath=upload/$PACKAGE_VERSION_TRIMMED/latest
mkdir -p ${buildPath%"/merge"}
mkdir -p ${latestPath%"/merge"}
mkdir -p ${versionedLatestPath%"/merge"}
cp -R dist/* ${buildPath%"/merge"}
cp -R dist/* ${latestPath%"/merge"}
cp -R dist/* ${versionedLatestPath%"/merge"}
- name: Copy to Azure Blob Storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch -d studio-ui -s upload/ --connection-string "${{ secrets.AZURE_CDN_STUDIO_DEV_CONNECTION_STRING }}" --overwrite true
build-deploy-stg:
needs: build-preflight
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PACKAGE_SECRET }}
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
scope: '@chili-publish'
- name: install dependencies
run: |
yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }}
- name: build code
run: yarn build
- name: copy file branch
run: |
export CURRENT_PACKAGE_VERSION=$(node --eval="var pjson = require('./package.json');console.log(pjson.version);")
export PACKAGE_VERSION_TRIMMED=$(node --eval="const version = '$CURRENT_PACKAGE_VERSION'.split('.'); const path = version[0] + '.' + version[1]; console.log(path)")
export PACKAGE_VERSION_PATCH=$(node --eval="const version = '$CURRENT_PACKAGE_VERSION'.split('.');console.log(version[2])")
buildPath=upload/$PACKAGE_VERSION_TRIMMED/$PACKAGE_VERSION_PATCH
latestPath=upload/latest
versionedLatestPath=upload/$PACKAGE_VERSION_TRIMMED/latest
mkdir -p ${buildPath%"/merge"}
mkdir -p ${latestPath%"/merge"}
mkdir -p ${versionedLatestPath%"/merge"}
cp -R dist/* ${buildPath%"/merge"}
cp -R dist/* ${latestPath%"/merge"}
cp -R dist/* ${versionedLatestPath%"/merge"}
- name: Copy to Azure Blob Storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch -d studio-ui -s upload/ --connection-string "${{ secrets.AZURE_CDN_STUDIO_STG_CONNECTION_STRING }}" --overwrite true
bump-version:
needs: build-preflight
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PACKAGE_SECRET }}
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
scope: '@chili-publish'
- uses: actions/download-artifact@v4
with:
name: coverage-artifact
path: coverage
- name: Display structure of downloaded files
run: ls -R
working-directory: coverage
- name: run readmeUpdater
run: yarn make-badges
- name: Bump version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git fetch origin
git checkout -B main origin/main
npm version prerelease --no-git-tag-version
- name: run readmeUpdater
run: yarn make-badges
- name: Push new version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add .
git commit -m "CI: Bump version to $(jq -r .version < package.json) [skip ci]" --allow-empty
git push origin main --follow-tags