-
Notifications
You must be signed in to change notification settings - Fork 42
130 lines (116 loc) · 3.74 KB
/
ci.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
name: CI
on:
pull_request:
branches: ['main']
workflow_call:
inputs:
rebuild:
type: boolean
description: 'Rebuild all images'
required: false
default: false
secrets:
NPM_AUTH_TOKEN:
description: 'NPM Auth Token'
required: true
outputs:
bake_file_existence:
description: 'Docker bake file existence'
value: ${{ jobs.build.outputs.bake_file_existence}}
jobs:
build:
runs-on: ubuntu-latest
outputs:
bake_file_existence: ${{ steps.bake_file_existence.outputs.files_exists }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Git config user
uses: snow-actions/git-config-user@v1.0.0
with:
name: NTNL Infra # Service Account's Name
email: infra@ntnl.io # Service Account's Email Address
- uses: actions/setup-node@v3
with:
node-version: 18.17.0
- name: Cache Rush
uses: actions/cache@v3
with:
path: |
common/temp/install-run
~/.rush
key: ${{ runner.os }}-${{ hashFiles('rush.json') }}
- name: Cache Rush Build Cache
uses: actions/cache@v3
with:
path: |
common/temp/build-cache
key: ${{ runner.os }}-rush-build-cache-${{ github.sha}}
restore-keys: |
${{ runner.os }}-rush-build-cache-
- name: Cache pnpm
uses: actions/cache@v3
with:
path: |
common/temp/pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Verify Change Logs
run: node common/scripts/install-run-rush.js change --verify
- name: Rush Install
run: node common/scripts/install-run-rush.js install
- name: Rush rebuild
if: ${{ inputs.rebuild }}
env:
REGISTRY: ghcr.io
REGISTRY_NAMESPACE: no-trade-no-life
CI_RUN: 'true'
run: node common/scripts/install-run-rush.js rebuild --verbose
- name: Rush build
if: ${{ !inputs.rebuild }}
env:
REGISTRY: ghcr.io
REGISTRY_NAMESPACE: no-trade-no-life
CI_RUN: 'true'
NODE_OPTIONS: '--max-old-space-size=8192'
run: node common/scripts/install-run-rush.js build --verbose
- name: Check docker bake file existence
id: bake_file_existence
uses: andstor/file-existence-action@v2
with:
files: './common/temp/docker-bake.json'
- name: package docker deploy artifacts
if: ${{ steps.bake_file_existence.outputs.files_exists == 'true' }}
run: |
tar -zcvf ./common/temp/docker-deploy.tar.gz \
./common/temp/docker-bake.json \
./common/temp/out
- name: Upload docker artifacts
uses: actions/upload-artifact@v3
if: ${{ steps.bake_file_existence.outputs.files_exists == 'true' }}
with:
name: docker-artifacts
retention-days: 1
path: |
./common/temp/docker-deploy.tar.gz
- name: Upload web artifacts
uses: actions/upload-artifact@v3
with:
name: web-artifacts
retention-days: 1
path: |
./ui/web/dist
if-no-files-found: error
- name: Upload docs artifacts
uses: actions/upload-artifact@v3
with:
name: docs-artifacts
retention-days: 1
path: |
./ui/docs/build
if-no-files-found: error
- name: Publish NPM Package
if: ${{ github.ref == 'refs/heads/main' }}
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: node common/scripts/install-run-rush.js publish -p --include-all