From a7096ebfa46cffabd9b5bb43a602a10f84c48851 Mon Sep 17 00:00:00 2001 From: Ryan Chou Date: Sun, 17 Nov 2024 23:45:01 +0800 Subject: [PATCH] feat: add gh-pages --- .github/workflows/publish.yml | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f44f1f5..a432ef1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,13 @@ -name: Publish to NPM +name: CI/CD Workflow + on: push: branches: - main + jobs: - publish: + publish-npm: + name: Publish to NPM runs-on: ubuntu-latest steps: @@ -31,3 +34,34 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + deploy-gh-pages: + name: Deploy to GitHub Pages + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: | + cd www + npm i --force + + - name: Build static files + run: | + cd www + npm run build + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: www/out + publish_branch: gh-pages