deploy-github-pages #563
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: deploy-github-pages | |
on: | |
push: | |
schedule: | |
# run at 3am in the morning (UTC) on weekdays | |
- cron: 0 3 * * 1-5 | |
jobs: | |
deploy-github-pages: | |
runs-on: ubuntu-latest | |
environment: github-pages | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup build environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Enable corepack and upgrade Yarn | |
run: | | |
corepack enable | |
yarn set version ./.yarn/releases/yarn-4.2.2.cjs | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Check code style | |
run: yarn gate | |
- name: Build app | |
run: yarn build | |
env: | |
DYNATRACE_API_TOKEN: ${{ secrets.DYNATRACE_API_TOKEN }} | |
- name: Get cached index.json | |
if: ${{ github.event_name != 'schedule' }} | |
run: curl --fail https://jkuroomsearch.app/data/index.json -o index.json | |
- name: Scrape new index.json | |
if: ${{ github.event_name == 'schedule' }} | |
run: node ./dist/js/scraper.js | |
- name: Move index.json | |
run: | | |
mkdir ./dist/data | |
mv index.json ./dist/data | |
- name: Deploy to GitHub Pages | |
if: success() | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
force_orphan: true |