md/.github/workflows/build.yml

44 lines
986 B
YAML
Raw Normal View History

2020-05-02 20:31:24 +08:00
name: Build and Deploy
2020-12-02 14:37:05 +08:00
2020-05-02 19:45:26 +08:00
on:
push:
2021-02-26 10:47:40 +08:00
branches: [main]
2020-12-02 14:37:05 +08:00
2020-05-02 19:45:26 +08:00
jobs:
2020-05-02 20:31:24 +08:00
build-and-deploy:
2020-05-02 19:45:26 +08:00
runs-on: ubuntu-latest
steps:
2020-05-02 20:31:24 +08:00
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
2021-02-26 10:47:40 +08:00
2020-11-25 09:47:08 +08:00
- name: Set up node
2021-01-30 11:39:13 +08:00
uses: actions/setup-node@v2
2020-11-25 09:47:08 +08:00
with:
2021-02-26 10:47:40 +08:00
node-version: "12"
2020-11-25 09:47:08 +08:00
check-latest: true
2021-02-26 10:47:40 +08:00
2020-11-25 09:47:08 +08:00
- name: Cache node modules
uses: actions/cache@v2
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
2021-02-26 10:47:40 +08:00
2020-11-25 09:47:08 +08:00
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
2020-05-02 20:31:24 +08:00
2020-11-25 09:47:08 +08:00
- name: Build
2021-02-26 10:47:40 +08:00
run: npm run build
2020-05-02 20:31:24 +08:00
- name: Deploy
2021-02-27 14:03:32 +08:00
uses: JamesIves/github-pages-deploy-action@4.0.0
2020-05-02 20:31:24 +08:00
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: dist