From 4bf704ce81c6e2192d236489808ae61da02e5353 Mon Sep 17 00:00:00 2001 From: ISNing <33572057+ISNing@users.noreply.github.com> Date: Sat, 10 Aug 2024 14:58:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(ci):=20=E5=8F=91=E5=B8=83=20`main`=20?= =?UTF-8?q?=E5=88=86=E6=94=AF=E5=88=B0=20GitHub=20Pages=20(#3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..af0a14a --- /dev/null +++ b/.github/workflows/publish.yml @@ -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/action-setup@v4.0.0 + - 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/upload-pages-artifact@v3.0.1 + 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