generated from itw-creative-works/ultimate-jekyll
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (75 loc) · 2.52 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
name: Compile and Build Site
on:
workflow_dispatch:
push:
branches:
- master
- main
- template
schedule:
- cron: '0 0 1 * *' # every 1st of the month at 12 am UTC
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
# env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
build:
# needs: nothing
runs-on: ubuntu-latest
timeout-minutes: 80
steps:
- name: Checkout main branch
uses: actions/checkout@v3
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.0'
bundler-cache: false
- name: Run bundle install
run: |
bundle install --path vendor/bundle
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 10
- name: Run node install
run: npm install
- name: Log dependency versions
run: |
echo "Ruby: $(ruby -v)"
echo "Gem: $(gem -v)"
echo "Bundler: $(bundle -v)"
echo "Node: $(node -v)"
echo "NPM: $(npm -v)"
echo "Dependencies: "
npm list --depth=0 || echo ""
- name: Run node build
run: npm run build -- --buildLocation='server' --skipJekyll='true'
- name: Create build.json
run: |
export TZ=UTC date
timestamp_utc=$(date +%FT%TZ)
export TZ=America/Los_Angeles date
timestamp_pst=$(date +%FT%TZ)
temp_build_json=$(cat @output/build/build.json)
echo account: $GITHUB_ACTOR
echo repo: $GITHUB_REPOSITORY
echo timestamp_utc: $timestamp_utc
echo timestamp_pst: $timestamp_pst
echo build.json: $temp_build_json
build_log_path="@output/build/build.json"
sed "s/%TIMESTAMP_UTC_GHP%/$timestamp_utc/g" $build_log_path > "$build_log_path"-temp && mv "$build_log_path"-temp $build_log_path
sed "s/%TIMESTAMP_PST_GHP%/$timestamp_pst/g" $build_log_path > "$build_log_path"-temp && mv "$build_log_path"-temp $build_log_path
sed -n '1h;1!H;${;g;s/GEN>>>.*<<<GEN/<REDACTED FOR LIVE PUBLISH>/g;p;}' .gitignore > .gitignore
- name: Build Jekyll
uses: helaili/jekyll-action@v2
env:
JEKYLL_PAT: ${{ secrets.GH_TOKEN }}
- name: Purge CloudFlare Cache
run: npm run cloudflare:purge
- name: Purge Artifacts
uses: kolpav/purge-artifacts-action@v1
with:
token: ${{ secrets.GH_TOKEN }}
expire-in: 0 # Set this to 0 to delete all artifacts