2020-05-02 20:31:24 +08:00
|
|
|
name: Build and Deploy
|
2020-12-02 14:37:05 +08:00
|
|
|
|
2020-05-02 19:45:26 +08:00
|
|
|
on:
|
|
|
|
push:
|
2021-02-26 10:47:40 +08:00
|
|
|
branches: [main]
|
2021-11-23 14:22:01 +08:00
|
|
|
workflow_dispatch:
|
2020-12-02 14:37:05 +08:00
|
|
|
|
2020-05-02 19:45:26 +08:00
|
|
|
jobs:
|
2020-05-02 20:31:24 +08:00
|
|
|
build-and-deploy:
|
2020-05-02 19:45:26 +08:00
|
|
|
runs-on: ubuntu-latest
|
2023-12-15 20:32:18 +08:00
|
|
|
if: github.repository == 'doocs/md'
|
2020-05-02 19:45:26 +08:00
|
|
|
steps:
|
2020-05-02 20:31:24 +08:00
|
|
|
- name: Checkout
|
2023-05-10 17:23:23 +08:00
|
|
|
uses: actions/checkout@v3
|
2020-05-02 20:31:24 +08:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2021-02-26 10:47:40 +08:00
|
|
|
|
2020-11-25 09:47:08 +08:00
|
|
|
- name: Set up node
|
2023-05-10 17:23:23 +08:00
|
|
|
uses: actions/setup-node@v3
|
2020-11-25 09:47:08 +08:00
|
|
|
with:
|
2023-05-10 17:54:48 +08:00
|
|
|
node-version: 20
|
2021-02-26 10:47:40 +08:00
|
|
|
|
2020-11-25 09:47:08 +08:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install
|
2020-05-02 20:31:24 +08:00
|
|
|
|
2020-11-25 09:47:08 +08:00
|
|
|
- name: Build
|
2021-02-26 10:47:40 +08:00
|
|
|
run: npm run build
|
|
|
|
|
2020-05-02 20:31:24 +08:00
|
|
|
- name: Deploy
|
2023-05-10 19:58:10 +08:00
|
|
|
uses: JamesIves/github-pages-deploy-action@v4
|
2020-05-02 20:31:24 +08:00
|
|
|
with:
|
2021-08-22 11:55:00 +08:00
|
|
|
branch: gh-pages
|
|
|
|
folder: dist
|
2021-04-25 11:05:56 +08:00
|
|
|
|
2021-11-09 09:36:59 +08:00
|
|
|
sync-to-gitee:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.repository == 'doocs/md'
|
|
|
|
needs: build-and-deploy
|
|
|
|
steps:
|
2021-04-25 11:05:56 +08:00
|
|
|
- name: Sync to Gitee
|
2021-11-09 09:36:59 +08:00
|
|
|
uses: wearerequired/git-mirror-action@v1
|
2021-04-25 11:05:56 +08:00
|
|
|
env:
|
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
|
|
|
|
with:
|
|
|
|
source-repo: git@github.com:doocs/md.git
|
|
|
|
destination-repo: git@gitee.com:Doocs/md.git
|