-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (78 loc) · 2.86 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
name: Build
on:
push:
branches:
- "trunk"
workflow_dispatch:
env:
NODEJS_VERSION: 18.16.1
IMAGE_NAME: ghcr.io/misfits-labs/wega-platform
REGISTRY: ghcr.io
jobs:
# NOTE: Each job runs in its own VM
job_build:
name: Build
runs-on: ubuntu-22.04
environment: qa
steps:
- uses: actions/checkout@v3
# NOTE: Checkout action shall change working dir
- name: Versioning
env:
REF: ${{github.ref}}
GSAP_TOKEN: ${{github.GSAP_TOKEN}}
VITE_RPC_PROVIDER_ALCHEMY: ${{ github.VITE_RPC_PROVIDER_ALCHEMY }}
VITE_WALLET_CONNECT_ID: ${{ github.VITE_WALLET_CONNECT_ID }}
VITE_FIREBASE_API_KEY: ${{ github.VITE_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ github.VITE_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_DB_URL: ${{ github.VITE_FIREBASE_DB_URL }}
VITE_FIREBASE_PROJECT_ID: ${{ github.VITE_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ github.VITE_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ github.VITE_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ github.VITE_FIREBASE_APP_ID }}
run: |
echo "REF=$REF"
echo "REF=$REF" >> $GITHUB_ENV
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -7)
echo "SHORT_COMMIT=$SHORT_COMMIT"
echo "SHORT_COMMIT=$SHORT_COMMIT" >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{env.NODEJS_VERSION}}
cache: 'npm'
env:
GSAP_TOKEN: ${{secrets.GSAP_TOKEN}}
- name: Install dependencies
env:
GSAP_TOKEN: ${{secrets.GSAP_TOKEN}}
run: |
npm install --frozen-lockfile
# Due to front-end nature of environment config, need specific image for each environment
- name: Build image qa
env:
GSAP_TOKEN: ${{secrets.GSAP_TOKEN}}
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
VITE_RPC_PROVIDER_ALCHEMY: ${{secrets.VITE_RPC_PROVIDER_ALCHEMY}}
VITE_WALLET_CONNECT_ID: ${{secrets.VITE_WALLET_CONNECT_ID}}
run: |
# cp .env.qa .env
# TODO Temporary disable CI to test deployment
CI=false yarn build
QA_TAG=${SHORT_COMMIT}-qa
echo "QA_TAG=$QA_TAG"
echo "QA_TAG=$QA_TAG" >> $GITHUB_ENV
echo "docker build -t $IMAGE_NAME:$QA_TAG ."
docker build -t $IMAGE_NAME:$QA_TAG .
- name: Docker login
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image qa
run: |
echo "docker push $IMAGE_NAME:$QA_TAG"
docker push $IMAGE_NAME:$QA_TAG
# TODO Build stg
# TODO Build prod