更改网站名称 #98
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 Hexo | |
on: | |
push: | |
branches: [dev] | |
pull_request: | |
branches: [dev] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Setup Hexo Blog Dependencies | |
run: | | |
npm install hexo-cli -g | |
npm install | |
- name: Prepare SSH key and known hosts | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Build with Hexo | |
run: | | |
hexo clean | |
hexo generate | |
hexo deploy | |
ls | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: public | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |