Merge pull request #25 from jhongyu/dependabot/npm_and_yarn/dompurify… #18
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 | |
on: | |
push: | |
branches: [source] | |
jobs: | |
hexo-deploy: | |
runs-on: ubuntu-latest | |
name: deploy blog. | |
env: | |
TZ: Asia/Shanghai | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true # Checkout private submodules(themes or something else). | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Get npm cache directory | |
id: npm-cache | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
# Caching dependencies to speed up workflows. (GitHub will remove any cache entries that have not been accessed in over 7 days.) | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Install dependencies & Generate static files | |
run: | | |
node -v | |
npm run build | |
# Deploy hexo blog website. | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
# Use the output from the `deploy` step(use for test action) | |
- name: Get the output | |
run: | | |
echo "${{ steps.deploy.outputs.notify }}" |