-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 1.97 KB
/
build_deploy.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
name: Main
on:
push:
branches:
- main
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Cache bundler gems
id: cache-bundler
uses: actions/cache@v4
with:
path: .bundler
key: ${{ runner.os }}-gems-v2-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-v2-
- name: Install Bundler & Gems
if: steps.cache-bundler.outputs.cache-hit != 'true'
run: |
gem install bundler
bundle config set --local without 'development'
bundle config set --local path .bundler
bundle install --jobs "$(nproc)"
- name: Install Bundler only
if: steps.cache-bundler.outputs.cache-hit == 'true'
run: |
gem install bundler
bundle config set --local without 'development'
bundle config set --local path .bundler
- name: Cache nanoc
id: cache-nanoc
uses: actions/cache@v4
with:
path: output
key: ${{ runner.os }}-nanoc-prod-v2-${{ hashFiles('content/**', 'Rules', 'nanoc.yaml', 'lib/**', 'layouts/**') }}
restore-keys: |
${{ runner.os }}-nanoc-prod-v2-
- name: Build
id: build
run: |
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
export LC_ALL=en_US.UTF-8
bundle exec nanoc compile --env=prod -V
- name: Setup Node
if: steps.build.outputs.need_deploy == 0
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'npm'
- name: Deploy prod
env:
GIT_SHA: ${{ github.sha }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: |
npm ci
node_modules/.bin/firebase deploy --only hosting -m "GitHub Actions@${GIT_SHA::8}" --token "$FIREBASE_TOKEN" --non-interactive