From bce36b71ce46a612f68505d20cfae62b5431cff3 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Thu, 17 Jul 2025 16:04:37 +0800 Subject: [PATCH] feat: deploy PR preview to gh pages --- .github/workflows/ci.yml | 23 +++++++++++++++++-- .github/workflows/deploy-gh-page.yml | 29 ------------------------ .github/workflows/py313-sync-cpython.yml | 10 ++++---- 3 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/deploy-gh-page.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6bd32c1cd..bcbf54316d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,15 @@ name: build +concurrency: preview-${{ github.ref }} + +permissions: + contents: write on: pull_request: jobs: ci: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -19,5 +23,20 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v6 - - name: Validate + - name: Build HTML Docs run: VERSION=${{ github.event.repository.default_branch }} JOBS=4 MODE=html make all + + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Deploy PR Doc Preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ../cpython/Doc/build/html + token: ${{ steps.app-token.outputs.token }} + preview-branch: gh-pages + umbrella-dir: pr-preview + action: auto diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml deleted file mode 100644 index 2c7442c1a8..0000000000 --- a/.github/workflows/deploy-gh-page.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: deploy-gh-page - -on: - push: - branches: - - "3.13" - -jobs: - cd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Dependencies - run: sudo apt-get install gettext - - - name: Install uv - uses: astral-sh/setup-uv@v6 - - - name: Build - run: JOBS=4 MODE=html make all - - - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.7.3 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: ../cpython/Doc/build/html - CLEAN: true diff --git a/.github/workflows/py313-sync-cpython.yml b/.github/workflows/py313-sync-cpython.yml index f3362c52c5..e826525144 100644 --- a/.github/workflows/py313-sync-cpython.yml +++ b/.github/workflows/py313-sync-cpython.yml @@ -36,17 +36,17 @@ jobs: - name: Sync with CPython run: make clone merge rm_cpython wrap - - uses: tibdex/github-app-token@v2 - id: generate-token + - uses: actions/create-github-app-token@v2 + id: app-token with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v6 with: - token: ${{ steps.generate-token.outputs.token }} + token: ${{ steps.app-token.outputs.token }} commit-message: sync with cpython ${{ env.LATEST_COMMIT_ID }} committer: GitHub author: github-actions[bot]