部署到 Github Pages #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 部署到 Github Pages | |
on: | |
workflow_run: | |
workflows: ["构建到 gh-pages 分支"] | |
types: | |
- completed | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
upload: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: 输出当前产物 | |
run: ls -la ./ | |
- name: 上传构建产物 | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./ | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: upload | |
steps: | |
- name: 部署 GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |