Skip to content
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

fix: gh-pages to Actions and fix the path bug #490

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
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
46 changes: 25 additions & 21 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

</details>

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

</details>
Expand All @@ -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`.

</details>

## GitHub Actions
Expand Down