From b2845f78677d90ea3a20d769c42c066d6aeb137d Mon Sep 17 00:00:00 2001 From: hemengyang Date: Thu, 19 May 2022 12:33:10 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=BD=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 26 +++++++++++++++++- .github/workflows/website-preview.yml | 39 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/website-preview.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 756d95a..b715966 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,4 +83,28 @@ jobs: push: true tags: felinae98/nonebot-bison:${{ github.event.release.tag_name }}-sentry cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max + deploy-web: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Docs + run: yarn docs:build + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1 + with: + publish-dir: "./docs/.vuepress/dist" + production-deploy: true + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy ${{ github.event.release.tag_name }}" + enable-commit-comment: false + alias: ${{ github.event.release.tag_name }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.github/workflows/website-preview.yml b/.github/workflows/website-preview.yml new file mode 100644 index 0000000..f6fcbff --- /dev/null +++ b/.github/workflows/website-preview.yml @@ -0,0 +1,39 @@ +name: Site Deploy(Preview) + +on: + pull_request_target: + +jobs: + preview: + runs-on: ubuntu-latest + concurrency: + group: pull-request-preview-${{ github.event.number }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Setup Node Environment + uses: ./.github/actions/setup-node + + - name: Build Docs + run: yarn docs:build + + - name: Get Deploy Name + run: | + echo "DEPLOY_NAME=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1 + with: + publish-dir: "./docs/.vuepress/dist" + production-deploy: false + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}" + enable-commit-comment: false + alias: ${{ env.DEPLOY_NAME }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}