From 42e20e22034bdce77203396d4b1b040bf3c5fd21 Mon Sep 17 00:00:00 2001 From: Northword Date: Wed, 30 Oct 2024 13:44:13 +0800 Subject: [PATCH] ci: deploy to main branch of zotero-chinese.github.io to override main--zotero-zh.netlify.app --- .github/workflows/ci.yml | 61 ++++++++++++++-------------- .github/workflows/deploy-preview.yml | 2 +- src/public/_redirects | 1 + src/public/readme.md | 7 ++++ 4 files changed, 40 insertions(+), 31 deletions(-) create mode 100644 src/public/readme.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a2b95c..42eb512 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,43 +50,44 @@ jobs: uses: JamesIves/github-pages-deploy-action@v4.6.8 with: repository-name: zotero-chinese/zotero-chinese.github.io - branch: gh-pages + branch: main folder: dist single-commit: true token: ${{ secrets.ACCESS_TOKEN }} git-config-name: github-actions[bot] git-config-email: github-actions[bot]@users.noreply.github.com - deploy-netlify: - name: Deploy to Netlify - if: github.ref_name == 'main' && github.event_name != 'pull_request' && github.repository == 'zotero-chinese/website' - needs: - - build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 + # 当前将 netlify 链接到 zotero-chinese.github.io 仓库的 main 分支,启用自动构建,故无需此任务 + # deploy-netlify: + # name: Deploy to Netlify + # if: github.ref_name == 'main' && github.event_name != 'pull_request' && github.repository == 'zotero-chinese/website' + # needs: + # - build + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 - - name: Download Build Output - uses: actions/download-artifact@v4 - with: - name: build-result - path: dist + # - name: Download Build Output + # uses: actions/download-artifact@v4 + # with: + # name: build-result + # path: dist - - name: Install pnpm - uses: pnpm/action-setup@v3 - with: - version: 9 + # - name: Install pnpm + # uses: pnpm/action-setup@v3 + # with: + # version: 9 - - name: Install Netlify CLI - run: pnpm install -g netlify-cli + # - name: Install Netlify CLI + # run: pnpm install -g netlify-cli - - name: Push to Netlify - uses: nick-fields/retry@v3 - with: - timeout_minutes: 3 - max_attempts: 3 - command: netlify deploy --dir 'dist' --prod --debug - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + # - name: Push to Netlify + # uses: nick-fields/retry@v3 + # with: + # timeout_minutes: 3 + # max_attempts: 3 + # command: netlify deploy --dir 'dist' --prod --debug + # env: + # NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + # NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index dfcc2c7..cfdb196 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -46,7 +46,7 @@ jobs: uses: nwtgck/actions-netlify@v3.0 with: publish-dir: dist - deploy-message: Deploy from GitHub Actions + deploy-message: 'Deploy from GitHub Actions PR #${{ env.PR_NUM }}' production-deploy: false alias: deploy-preview-${{ env.PR_NUM }} enable-commit-comment: false diff --git a/src/public/_redirects b/src/public/_redirects index 03b35da..85c260a 100644 --- a/src/public/_redirects +++ b/src/public/_redirects @@ -4,3 +4,4 @@ # https://github.com/zotero-chinese/website/issues/100 https://zotero-zh.netlify.app/* https://zotero-chinese.com/:splat 301! https://main--zotero-zh.netlify.app/* https://zotero-chinese.com/:splat 301! +https://gh-pages--zotero-zh.netlify.app/* https://zotero-chinese.com/:splat 301! diff --git a/src/public/readme.md b/src/public/readme.md new file mode 100644 index 0000000..eeca55f --- /dev/null +++ b/src/public/readme.md @@ -0,0 +1,7 @@ +# zotero-chinese.com + + + +![GitHub repo size](https://img.shields.io/github/repo-size/zotero-chinese/zotero-chinese.github.io) + +本仓库 (`zotero-chinese/zotero-chinese.github.io`) 存放了 Zotero 中文社区官方网站的构建结果,是 GitHub Pages 兼容仓库,仅包含构建结果,不包含文档源文件,你可以直接 [访问网站](https://zotero-chinese.com)。贡献文档请访问 [zotero-chinese/wiki](https://github.com/zotero-chinese/wiki) 仓库。