Skip to content

add clarity

add clarity #411

Workflow file for this run

# CLOUDFLARE_API_KEY="XXXX"
# CLOUDFLARE_ZONE="XXXX"
name: Build
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 1"
push:
branches:
- master
permissions:
contents: write
jobs:
# Use workflow token for API reads in the build and keep least-privilege runtime access.
# Write is required only for publishing gh-pages below.
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
HUGO_VERSION: 0.162.1
steps:
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates curl ffmpeg node-less python3-numpy python3-yaml
HUGO_TARBALL="hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
curl -fsSLo "/tmp/${HUGO_TARBALL}" "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_TARBALL}"
sudo tar -C /usr/local/bin -xzf "/tmp/${HUGO_TARBALL}" hugo
hugo version
- name: Clone master
run: |
git config --global user.name "GithubActions"
git config --global user.email "actions@robot.jmonkeyengine.org"
git clone --single-branch --depth 1 --recurse-submodules --branch master https://github.com/${GITHUB_REPOSITORY}.git project
- name: Clone gh-pages
run: |
git config --global user.name "GithubActions"
git config --global user.email "actions@robot.jmonkeyengine.org"
git clone --no-checkout --single-branch --branch gh-pages https://github.com/${GITHUB_REPOSITORY}.git generated
cd generated
git reset --hard `git rev-list --max-parents=0 HEAD`
cd ..
- name: Refresh dynamic data and build
run: |
cd project
chmod +x ./make.sh
# make.sh refreshes OpenCollective/GitHub data and the showcase mashup.
HEADLESS=1 SHOWCASE_MASHUP_MAX_IMAGES=30 ./make.sh
mkdir -p public
echo "1" > public/.nojekyll
- name: Deploy
shell: bash
run: |
shopt -s dotglob
cp -Rf project/public/* generated/
cd generated
git add .
git commit -m "Update data - `date`"
header=$(printf "x-access-token:%s" "${GITHUB_TOKEN}" | base64 | tr -d '\n')
git -c http.extraheader="AUTHORIZATION: basic ${header}" push origin gh-pages --force
- name: Purge Cloudflare Cache
shell: bash
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_KEY }}" \
-H "Content-Type: application/json" --data '{"purge_everything":true}'