Repository navigation
61 lines (51 loc) · 1.76 KB
/
Copy pathfirebase.yml
File metadata and controls
61 lines (51 loc) · 1.76 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
name: Build and Deploy to Firebase
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v7
with:
# Full history: _plugins/posts-lastmod-hook.rb derives each post's
# last-modified date from git log, which a shallow clone cannot provide.
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Install dependencies
run: |
bundle install
- name: Build Jekyll
run: |
bundle exec jekyll build
env:
JEKYLL_ENV: production
- name: Deploy to Firebase
run: |
# Preserve the firebase-tools exit status when the output is piped through tee.
set -o pipefail
echo "$GCP_SA_KEY" | base64 -d > /tmp/gcp_key.json
deploy_log=$(mktemp /tmp/firebase-deploy.XXXXXX.log)
if GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcp_key.json npx firebase-tools deploy --only hosting --project zhe-dev 2>&1 | tee "$deploy_log"; then
rm -f "$deploy_log"
exit 0
fi
# Firebase Hosting returns this release error when the uploaded version is already live.
if grep -Eq "Can't release to .*current active version" "$deploy_log"; then
echo "Firebase Hosting already serves this version; treating deploy as successful."
rm -f "$deploy_log"
exit 0
fi
rm -f "$deploy_log"
exit 1
env:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
- name: Clean up credentials
if: always()
run: rm -f /tmp/gcp_key.json