Skip to content

Commit 5ed8927

Browse files
authored
chore: update deployment config (#4367)
1 parent 8a9fb14 commit 5ed8927

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

.github/workflows/deploy.yml

+27-34
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: deploy
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -12,22 +13,14 @@ on:
1213
- lcof/**
1314
- lcci/**
1415
- basic/**
15-
workflow_dispatch:
16-
17-
env:
18-
MKDOCS_API_KEYS: ${{ secrets.MKDOCS_API_KEYS }}
19-
20-
permissions:
21-
contents: write
2216

2317
concurrency:
2418
group: ${{github.workflow}} - ${{github.ref}}
2519
cancel-in-progress: true
2620

2721
jobs:
28-
deploy:
22+
build:
2923
runs-on: ubuntu-latest
30-
if: github.repository == 'doocs/leetcode'
3124
steps:
3225
- uses: actions/checkout@v4
3326
- uses: actions/checkout@v4
@@ -62,36 +55,36 @@ jobs:
6255
python3 -m pip install -r requirements.txt
6356
python3 -m pip install "mkdocs-material[imaging]"
6457
sudo apt-get install pngquant
58+
59+
- name: Set MKDOCS_API_KEYS environment variable
60+
run: echo "MKDOCS_API_KEYS=${{ secrets.MKDOCS_API_KEYS }}" >> $GITHUB_ENV
6561

6662
- run: |
6763
python3 main.py
6864
mkdocs build -f mkdocs.yml
6965
mkdocs build -f mkdocs-en.yml
7066
71-
- name: Deploy
72-
uses: peaceiris/actions-gh-pages@v4
73-
with:
74-
github_token: ${{ secrets.GITHUB_TOKEN }}
75-
publish_dir: ./site
76-
cname: leetcode.doocs.org
67+
- name: Generate CNAME file
68+
run: echo "leetcode.doocs.org" > ./site/CNAME
7769

78-
# sync:
79-
# runs-on: ubuntu-latest
80-
# needs: deploy
81-
# if: github.repository == 'doocs/leetcode'
82-
# steps:
83-
# - name: Sync to gitee.com
84-
# uses: wearerequired/git-mirror-action@master
85-
# env:
86-
# SSH_PRIVATE_KEY: ${{ secrets.RSA_PRIVATE_KEY }}
87-
# with:
88-
# source-repo: [email protected]:doocs/leetcode.git
89-
# destination-repo: [email protected]:Doocs/leetcode.git
70+
- name: Upload artifact
71+
uses: actions/upload-pages-artifact@v3
72+
with:
73+
path: ./site
9074

91-
# - name: Build Gitee Pages
92-
# uses: yanglbme/gitee-pages-action@main
93-
# with:
94-
# gitee-username: yanglbme
95-
# gitee-password: ${{ secrets.GITEE_PASSWORD }}
96-
# gitee-repo: doocs/leetcode
97-
# branch: gh-pages
75+
# Deployment job
76+
deploy:
77+
needs: build
78+
permissions:
79+
pages: write
80+
id-token: write
81+
environment:
82+
name: github_pages
83+
url: ${{ steps.deployment.outputs.page_url }}
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Deploy to GitHub Pages
87+
id: deployment
88+
uses: actions/deploy-pages@v4
89+
with:
90+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)