Skip to content

Publish

Publish #15

Workflow file for this run

name: Publish
permissions:
contents: write
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Git
run: |
id=$(curl --silent "https://api.github.com/users/${{github.actor}}" | jq --raw-output ".id")
git config --global user.name "${{github.actor}}"
git config --global user.email "$id+${{github.actor}}@users.noreply.github.com"
- name: Setup mise
uses: jdx/mise-action@v2
- name: Install Extension Dependencies
working-directory: extension
run: pnpm install --frozen-lockfile
- name: Install Site Dependencies
working-directory: site
run: pnpm install --frozen-lockfile
- name: Build Site
working-directory: site
run: pnpm build
- name: Publish Site
working-directory: site
run: |
td=$(mktemp -d)
cd dist
git clone --quiet --no-checkout --single-branch --branch "gh-pages" \
"https://${{secrets.GIT_PUBLISH_TOKEN}}@github.com/${{github.repository}}.git" "$td"
mv "$td/.git" .
git add .
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit --quiet --message "$(date --utc)"
git push
fi