diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 627fd9df770..7e889b845f3 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -11,10 +11,23 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: 'pages' + cancel-in-progress: true + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" - build: + build_and_deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} # The type of runner that the job will run on runs-on: ubuntu-latest @@ -47,25 +60,16 @@ jobs: restore-keys: | ${{ runner.os }}-pnpm-store- - - run: | - pnpm install - - run: | - pnpm build - env: - PATH_PREFIX: / + - name: Install dependencies + run: pnpm install + - name: Build + run: PATH_PREFIX=/${{ github.event.repository.name }} pnpm build - - name: GitHub Pages - uses: crazy-max/ghaction-github-pages@v3.1.0 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 with: - # Git branch where site will be deployed - target_branch: gh-pages - # Create incremental commit instead of doing push force - keep_history: true - # Build directory to deploy - build_dir: dist - # Write the given domain name to the CNAME file - #fqdn: custom.domain.name # optional - # Prevent Jekyll from building the site - jekyll: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Upload dist repository + path: './dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/README-CN.md b/README-CN.md index cfe7198b6d3..5d66c63c7a5 100644 --- a/README-CN.md +++ b/README-CN.md @@ -808,7 +808,7 @@ python3(python) run_page/gen_svg.py --from-db --type circular --use-localtime 4. 在仓库的`Settings > Secrets and variables > Actions`页面添加对应服务的环境配置信息,参考不同平台[配置](#支持)。 3. 同步数据并发布 GitHub Pages 1. 手动触发`Run Data Sync`的 Github Action 完成数据同步,完成后会自动触发`Publish GitHub Pages`的任务执行,等待执行完成; - 2. 开通仓库 GitHub Pages 功能,选择`gh-pages`分支和`/(root)`目录。 + 2. 开通仓库 GitHub Pages 功能,选择`GitHub Actions` diff --git a/README.md b/README.md index 5327c4af517..ffb67e7b804 100644 --- a/README.md +++ b/README.md @@ -622,8 +622,6 @@ For more display effects, see: 4. Scroll down, click `Environment variables`, then variable below: - > Variable name = `PYTHON_VERSION`, Value = `3.7` - 5. Click `Save and Deploy` @@ -633,12 +631,10 @@ For more display effects, see: 1. If you are using a custom domain for GitHub Pages, open [.github/workflows/gh-pages.yml](.github/workflows/gh-pages.yml), change `fqdn` value to the domain name of your site. -2. (_Skip this step if you're **NOT** using a custom domain_) Modify `.github/workflows/gh-pages.yml`, change `PATH_PREFIX` value to the root path. If the repository name is `running_page`, the value will be `/running_page`. +2. Go to repository's `Settings -> GitHub Pages -> Source`, choose `GitHub Actions` 3. Go to repository's `Actions -> Workflows -> All Workflows`, choose `Publish GitHub Pages` from the left panel, click `Run workflow`. Make sure the workflow runs without errors, and `gh-pages` branch is created. -4. Go to repository's `Settings -> GitHub Pages -> Source`, choose `Branch: gh-pages`, click `Save`. - ## GitHub Actions