doc: 为SIG-template作出贡献 (#8) #22
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: Build and Deploy | |
on: | |
push: | |
branches: [ "master"] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
ensure-toolchain: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: "20.11.0" | |
- name: Cache dependencies | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }} | |
- name: echo node version | |
run: node -v | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
name: Install dependencies | |
continue-on-error: true | |
run: | | |
sudo apt update && sudo apt install -y build-essential | |
source ~/.bashrc | |
npm install | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: [ensure-toolchain] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }} | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: "20.11.0" | |
- name: Build | |
run: npm run docs:build | |
- name: Set CNAME | |
run: echo 'community.dragonos.org' > ./.vuepress/dist/CNAME | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./.vuepress/dist |