feat: update deploy github pages workflow #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: | |
push: | |
branches: | |
- master | |
- demo-source | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@master | |
with: | |
ref: demo-source | |
- name: Use Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: '18.x' | |
- name: Cache NPM dependencies | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-npm-cache | |
restore-keys: | | |
${{ runner.OS }}-npm-cache | |
- name: Prepare source | |
run: | | |
npm install hexo-renderer-ejs hexo-renderer-dartsass --save | |
git clone -b master https://github.com/ahonn/hexo-theme-even.git themes/even | |
cp themes/even/_config.yml.example themes/even/_config.yml | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./public | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |