-
Notifications
You must be signed in to change notification settings - Fork 5
99 lines (85 loc) · 2.98 KB
/
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
name: Production Build
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
push:
branches: [dev, master]
jobs:
build:
runs-on: ubuntu-latest
environment: production
strategy:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Create .env.pro file
run: |
cat << EOF > .env.pro
# Git info
COMMIT_SHA="${{ github.sha }}"
BRANCH_NAME="${{ github.ref_name }}"
PR_TITLE="${{ github.event.pull_request.title || '' }}"
PR_NUMBER="${{ github.event.pull_request.number || '' }}"
# Google drive
GD_BACKUP_NAME="${{ vars.GD_BACKUP_NAME }}"
GD_FOLDER="${{ vars.GD_FOLDER }}"
GD_AES_KEY="${{ secrets.GD_AES_KEY }}"
GD_IV="${{ secrets.GD_IV }}"
GOOGLE_API="${{ secrets.GOOGLE_API }}"
FB_TOKEN="${{ secrets.FB_TOKEN }}"
# firebase
FB_API_KEY="${{ secrets.FB_API_KEY }}"
FB_AUTH_DOMAIN="${{ secrets.FB_AUTH_DOMAIN }}"
FB_DATABASE_URL="${{ secrets.FB_DATABASE_URL }}"
FB_PROJECTID="${{ secrets.FB_PROJECTID }}"
FB_STORAGE_BUCKET="${{ secrets.FB_STORAGE_BUCKET }}"
FB_MESSAGING_SENDER_ID="${{ secrets.FB_MESSAGING_SENDER_ID }}"
FB_APP_ID="${{ secrets.FB_APP_ID }}"
FB_MEASUREMENT_ID="${{ secrets.FB_MEASUREMENT_ID }}"
FB_FUNCTIONS="${{ secrets.FB_FUNCTIONS }}"
# manifest
OAUTH2_CLIENT_ID="${{ secrets.OAUTH2_CLIENT_ID }}"
OAUTH2_SCOPES="${{ vars.OAUTH2_SCOPES }}"
WC_PROJECTID="${{ secrets.WC_PROJECTID }}"
MIXPANEL_TOKEN="${{ secrets.MIXPANEL_TOKEN }}"
EOF
- name: Build production
run: pnpm run build:ci
env:
CI: true
COMMIT_SHA: ${{ github.sha }}
BRANCH_NAME: ${{ github.ref_name }}
PR_TITLE: ${{ github.event.pull_request.title || '' }}
PR_NUMBER: ${{ github.event.pull_request.number || '' }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: extension-build
path: dist/
- name: Check build size
run: |
echo "Build size:"
du -sh dist/