-
Notifications
You must be signed in to change notification settings - Fork 19
66 lines (64 loc) · 2.52 KB
/
common-firebase-hosting-release.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
on:
workflow_call:
inputs:
config-path:
required: true
type: string
secrets:
envPAT:
required: true
HOTWAX_PUBLIC_SECRET:
required: true
VUE_APP_FIREBASE_CONFIG:
required: false
VUE_APP_FIREBASE_VAPID_KEY:
required: false
jobs:
build_and_deploy:
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Checkout to latest release tag
run: |
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
- name: Install Dependencies
run: npm install
- name: Generate .env file
run: cp .env.example .env
- name: Set Firebase and VAPID Config
run: |
if [[ -n "$VUE_APP_FIREBASE_CONFIG" ]]; then
sed -i "s|VUE_APP_FIREBASE_CONFIG=.*|VUE_APP_FIREBASE_CONFIG=$VUE_APP_FIREBASE_CONFIG|g" .env
sed -i "s|VUE_APP_FIREBASE_VAPID_KEY=.*|VUE_APP_FIREBASE_VAPID_KEY='$VUE_APP_FIREBASE_VAPID_KEY'|g" .env
sed -i "s|const firebaseConfig =.*|const firebaseConfig = $VUE_APP_FIREBASE_CONFIG|g" public/firebase-messaging-sw.js
fi
env:
VUE_APP_FIREBASE_CONFIG: ${{ secrets.VUE_APP_FIREBASE_CONFIG }}
VUE_APP_FIREBASE_VAPID_KEY: ${{ secrets.VUE_APP_FIREBASE_VAPID_KEY }}
- name: Build
run: npm run build
- name: Install Firebase
run: npm install -g firebase-tools
- name: Set Firebase project
run: firebase use default --token "$HOTWAX_PUBLIC_SECRET"
env:
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
- name: Deploy
run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:uat
env:
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Fetch release tag"
run: |
echo "LABEL=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV
- name: "Create label"
run: gh label create "release-${{ env.LABEL }}" --color FF7F7E
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}