Skip to content

Publish to GitHub Pages #589

Publish to GitHub Pages

Publish to GitHub Pages #589

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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: 18
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version: '>=1.21.0'
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
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
pnpm install --no-frozen-lockfile
pnpm vendor-esbuild
- name: build esbuild-wasi
run: pnpm build-wasi
- 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