Skip to content

chore: update deployment config #4367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 27 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: deploy

on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -12,22 +13,14 @@ on:
- lcof/**
- lcci/**
- basic/**
workflow_dispatch:

env:
MKDOCS_API_KEYS: ${{ secrets.MKDOCS_API_KEYS }}

permissions:
contents: write

concurrency:
group: ${{github.workflow}} - ${{github.ref}}
cancel-in-progress: true

jobs:
deploy:
build:
runs-on: ubuntu-latest
if: github.repository == 'doocs/leetcode'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
Expand Down Expand Up @@ -62,36 +55,36 @@ jobs:
python3 -m pip install -r requirements.txt
python3 -m pip install "mkdocs-material[imaging]"
sudo apt-get install pngquant

- name: Set MKDOCS_API_KEYS environment variable
run: echo "MKDOCS_API_KEYS=${{ secrets.MKDOCS_API_KEYS }}" >> $GITHUB_ENV

- run: |
python3 main.py
mkdocs build -f mkdocs.yml
mkdocs build -f mkdocs-en.yml

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
cname: leetcode.doocs.org
- name: Generate CNAME file
run: echo "leetcode.doocs.org" > ./site/CNAME

# sync:
# runs-on: ubuntu-latest
# needs: deploy
# if: github.repository == 'doocs/leetcode'
# steps:
# - name: Sync to gitee.com
# uses: wearerequired/git-mirror-action@master
# env:
# SSH_PRIVATE_KEY: ${{ secrets.RSA_PRIVATE_KEY }}
# with:
# source-repo: [email protected]:doocs/leetcode.git
# destination-repo: [email protected]:Doocs/leetcode.git
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site

# - name: Build Gitee Pages
# uses: yanglbme/gitee-pages-action@main
# with:
# gitee-username: yanglbme
# gitee-password: ${{ secrets.GITEE_PASSWORD }}
# gitee-repo: doocs/leetcode
# branch: gh-pages
# Deployment job
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github_pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Loading