Skip to content

Commit

Permalink
feat(ci): 发布 main 分支到 GitHub Pages (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ISNing authored Aug 10, 2024
1 parent f07b5f7 commit 4bf704c
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Slides Publish CI

on:
push:
branches: [ main ]

jobs:
# Build job
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install playwright
run: pnpm exec playwright install
- name: Build the slide
run: pnpm run build
- name: Export the slide into PDF
run: pnpm run export
- name: Upload PDF
uses: actions/upload-artifact@v4
with:
name: slides-export.pdf
path: slides-export.pdf
- name: Upload GitHub Pages artifact
uses: actions/[email protected]
with:
# Artifact name
name: dist
# Path of the directory containing the static assets.
path: dist
# Duration after which artifact will expire in days.
retention-days: 0

# Deploy job
deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 4bf704c

Please sign in to comment.