From af4a265155ea893c0d108ea727245e59dfff8bb4 Mon Sep 17 00:00:00 2001 From: CoderSerio <2779066456@qq.com> Date: Tue, 25 Jun 2024 02:53:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20script=20for=20deploying=20=E2=9B=8F?= =?UTF-8?q?=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 52 ++++++++++++++++++++++++++++++++++++ deploy.sh | 6 +++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1c548ff --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Deploy Vue Site to GitHub Pages + +on: + push: + branches: [master] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + concurrency: + group: deploy + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + + - name: Install Dependencies in Doc Directory + working-directory: ./doc + run: pnpm install + + - name: Build Vue App + working-directory: ./doc + run: pnpm run build + + # 使用官方的actions/deploy-pages行动部署到GitHub Pages,但需注意actions/deploy-pages@v4并不存在,应使用其他适合的部署action + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + personal_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./doc/dist \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index 991f1ce..fad4726 100644 --- a/deploy.sh +++ b/deploy.sh @@ -3,3 +3,9 @@ set -e cd doc npm run build + +cd dist + +git init + +git checkout -b