UJ: Pre-merge commit + push #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |