-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (96 loc) · 4.35 KB
/
production-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
name: Build and deploy to PRD
on:
release:
types: [released]
jobs:
build:
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
- name: Bump version locally
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 patch --no-git-tag-version
- name: build code
run: yarn build
- name: Commit version changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add package.json yarn.lock
git commit -m "CI: Bump version to $(jq -r .version < package.json) [skip ci]" --allow-empty
git push origin main --follow-tags
- 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_PRD_CONNECTION_STRING }}" --overwrite true
bump-version:
needs: build
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: 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 preminor --no-git-tag-version
git add package.json yarn.lock
git commit -m "CI: Bump version to $(jq -r .version < package.json) [skip ci]" --allow-empty
git push origin main --follow-tags