Skip to content

Commit

Permalink
ci: deploy to main branch of zotero-chinese.github.io
Browse files Browse the repository at this point in the history
to override main--zotero-zh.netlify.app
  • Loading branch information
northword committed Oct 30, 2024
1 parent 68785ac commit 42e20e2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
61 changes: 31 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,44 @@ jobs:
uses: JamesIves/[email protected]
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: nwtgck/[email protected]
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
Expand Down
1 change: 1 addition & 0 deletions src/public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -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!
7 changes: 7 additions & 0 deletions src/public/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# zotero-chinese.com

<!-- 此文件将作为 zotero-chinese.github.io 仓库的自述文件,非此目录的说明文件 -->

![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) 仓库。

0 comments on commit 42e20e2

Please sign in to comment.