Skip to content

Publish to GitHub Pages #781

Publish to GitHub Pages

Publish to GitHub Pages #781

Workflow file for this run

name: Publish to GitHub Pages
on:
push:
branches:
- main
schedule:
- cron: '15 0 * * *'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 18
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
name: Install pnpm
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: pnpm install
run: pnpm install
- name: Update esbuild
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
LATEST=$(curl https://registry.npmjs.org/esbuild/latest | jq -r '.version')
if [[ -z "$LATEST" ]]; then
echo "Failed to get latest version"
exit 1
fi
if [[ "$LATEST" == "$(jq -r '.devDependencies.esbuild' package.json)" ]]; then
echo "Already up to date"
exit 0
fi
sed -i "s/\"esbuild\": \".*\"/\"esbuild\": \"$LATEST\"/" package.json
sed -i "s/\"@esbuild\/wasi-preview1\": \".*\"/\"@esbuild\/wasi-preview1\": \"$LATEST\"/" package.json
pnpm install --no-frozen-lockfile
pnpm vendor-esbuild
- name: Build
run: pnpm run build
- name: Commit update
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
message: Update esbuild
default_author: github_actions
- name: Setup Pages
id: pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: ./dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4