Microsoft 365 E5 白嫖教程 #129
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: Deploy Static Pages | |
on: | |
# master 分至推送时触发 | |
push: | |
branches: ["master"] | |
# 允许从“操作”选项卡手动运行此工作流 | |
workflow_dispatch: | |
# 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# 只允许一次并发部署,跳过在进行中的运行和最近排队的运行之间排队的运行。 | |
# 但是,不要取消正在进行的运行,因为我们希望完成这些生产部署。 | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
# 默认使用 bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# 部署 Gitee Pages | |
Deploy-Gitee: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 远程部署 Gitee Pages | |
uses: yanglbme/gitee-pages-action@main | |
with: | |
gitee-username: [email protected] | |
gitee-password: ${{ secrets.GITEE_PASSWORD }} | |
gitee-repo: hnest/hnest | |
branch: master | |
# 编译 GitHub Pages | |
Build-Repo: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 安装 Node.js v18.16.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: 安装 Hexo CLI | |
run: npm install -g hexo-cli | |
- name: 环境构建 | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: 构建 GitHub Pages | |
id: pages | |
uses: actions/configure-pages@v3 | |
- name: 编译 Hexo 项目使用 hnest.github.io | |
run: hexo clean && hexo generate --config yml/hnest.github.io.yml | |
- name: 上传静态文件至 HNest/hnest.github.io | |
env: | |
path_name: './public' | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
run: | | |
cd ${{ env.path_name }} | |
git config --global user.name "${{ env.user_name }}" | |
git config --global user.email "${{ env.user_email }}" | |
git init | |
git add . | |
git commit -m "${{ github.event.head_commit.message }}" | |
git remote add origin https://${{ github.actor }}:${{ secrets.TOKEN }}@github.com/HNest/hnest.github.io | |
git checkout -b main | |
git push origin main -f | |
# 编译 GitHub Pages | |
Build-Pages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 安装 Node.js v18.16.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: 安装 Hexo CLI | |
run: npm install -g hexo-cli | |
- name: 环境构建 | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: 构建 GitHub Pages | |
id: pages | |
uses: actions/configure-pages@v3 | |
- name: 编译 Hexo 项目使用 hnest.eu.org | |
env: | |
url: ${{ steps.deployment.outputs.page_url }} | |
run: hexo clean && hexo generate --config yml/hnest.eu.org.yml | |
- name: 上传静态页面 | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./public | |
# 部署 GitHub Pages | |
Deploy-Pages: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: Build-Pages | |
steps: | |
- name: 部署 GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
# 编译 Pages 至 gh-pages | |
Build-Tree: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 安装 Node.js v18.16.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: 安装 Hexo CLI | |
run: npm install -g hexo-cli | |
- name: Actions 环境构建 | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: 编译 Hexo 项目使用域名 hnest.eu.org | |
run: hexo generate --config yml/hnest.eu.org.yml | |
- name: 上传静态页面至分支 gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |