forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (85 loc) · 2.95 KB
/
buildWeb.yml
File metadata and controls
96 lines (85 loc) · 2.95 KB
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
name: Build Web
on:
workflow_call:
inputs:
ref:
description: Git ref to checkout and build
type: string
required: true
environment:
description: "'production', 'staging', or 'adhoc'"
type: string
required: true
pull-request-number:
description: Pull request number (used for adhoc builds)
type: string
default: ''
outputs:
TAR_FILENAME:
description: Filename of the .tar.gz web build artifact
value: ${{ jobs.build.outputs.TAR_FILENAME }}
ZIP_FILENAME:
description: Filename of the .zip web build artifact
value: ${{ jobs.build.outputs.ZIP_FILENAME }}
SOURCEMAP_FILENAME:
description: Filename of the web sourcemap artifact
value: ${{ jobs.build.outputs.SOURCEMAP_FILENAME }}
jobs:
build:
name: Build Web
runs-on: blacksmith-32vcpu-ubuntu-2404
outputs:
TAR_FILENAME: webBuild.tar.gz
ZIP_FILENAME: webBuild.zip
SOURCEMAP_FILENAME: merged-source-map.js.map
env:
PULL_REQUEST_NUMBER: ${{ inputs.pull-request-number }}
steps:
- name: Checkout
# v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
ref: ${{ inputs.ref }}
- name: Create .env.adhoc file based on staging
if: ${{ inputs.environment == 'adhoc' }}
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
- name: Inject CI data into JS bundle
if: ${{ inputs.environment == 'adhoc' && inputs.pull-request-number != '' }}
run: ./.github/scripts/inject-ci-data.sh PULL_REQUEST_NUMBER="$PULL_REQUEST_NUMBER"
- name: Setup Node
uses: ./.github/actions/composite/setupNode
- name: Build web
run: |
if [ "${{ inputs.environment }}" == "production" ]; then
npm run build
elif [ "${{ inputs.environment }}" == "staging" ]; then
npm run build-staging
else
npm run build-adhoc
fi
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Upload web sourcemaps artifact
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: web-sourcemaps-artifact
path: ./dist/merged-source-map.js.map
- name: Compress web build .tar.gz and .zip
run: |
tar -czvf webBuild.tar.gz dist
zip -r webBuild.zip dist
- name: Upload .tar.gz web build artifact
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: web-build-tar-gz-artifact
path: ./webBuild.tar.gz
- name: Upload .zip web build artifact
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: web-build-zip-artifact
path: ./webBuild.zip