Skip to content

Deploy to GitHub Pages #14469

Deploy to GitHub Pages

Deploy to GitHub Pages #14469

Workflow file for this run

name: Deploy to GitHub Pages
# inspired by https://blog.oldweb2.com/remix-static-site
on:
push:
branches: [main]
schedule:
# Run every hour on minute 14 — 14 picked rather arbitrarily as not on the
# top of the hour so that we're not trying to run on GitHub's servers when
# every other cron job is trying to run
- cron: "14 * * * *"
jobs:
build:
if: github.repository == 'philly-js-club/philly-js-club-website'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.2"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install --force
- run: npm run build
- name: Start server and mirror it with wget
run: |
npm run dev &
sleep 10 &&
cp -r public/ out &&
wget --mirror http://localhost:5173 -P out --no-host-directories --page-requisites --adjust-extension &&
wget --mirror http://localhost:5173/ad -P out --no-host-directories --page-requisites --adjust-extension &&
wget --mirror http://localhost:5173/ics-feed.ics -P out --no-host-directories --page-requisites --adjust-extension
echo "phillyjs.com" > out/CNAME
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./out
external_repository: philly-js-club/js-club-website-public