Skip to content

Publish Static Website #310

Publish Static Website

Publish Static Website #310

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Publish Static Website
on:
push:
branches:
- "develop"
schedule:
- cron: "0 0 * * *"
jobs:
publish:
environment: github-pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Use Node.js v18
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Setup Environment
run: |
git config --global user.name "bot"
git config --global user.email [email protected]
- name: npm install
run: npm install
- name: lint
run: npm run lint
- name: Build
env:
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_CONTENT }}
run: |
echo "${GOOGLE_APPLICATION_CREDENTIALS_CONTENT}" > ./hexo-pv-c7938b2e210b.json
export NODE_OPTIONS=--openssl-legacy-provider
npm run build:pageview
npm run build:webpack
npm run build:hexo
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: master