2019-11-09 14:52:28 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*'
|
2019-08-17 18:04:35 +08:00
|
|
|
|
|
|
|
name: Deploy workflow
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
install:
|
|
|
|
name: Install
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
node-version: [12.x]
|
|
|
|
|
|
|
|
steps:
|
2019-11-09 14:52:28 +08:00
|
|
|
- uses: actions/checkout@v1
|
2019-08-17 18:04:35 +08:00
|
|
|
|
2019-11-09 14:52:28 +08:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2019-08-17 18:04:35 +08:00
|
|
|
|
2019-11-14 00:31:03 +08:00
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.OS }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.OS }}-build-
|
|
|
|
${{ runner.OS }}-
|
|
|
|
|
2019-11-09 14:52:28 +08:00
|
|
|
- name: Install Lint Build
|
|
|
|
run: |
|
|
|
|
yarn
|
|
|
|
yarn lint
|
|
|
|
yarn build
|
2019-08-17 18:04:35 +08:00
|
|
|
|
2019-11-09 14:52:28 +08:00
|
|
|
- name: Push to gh-pages
|
|
|
|
# push only when the branch is publish
|
|
|
|
# if: github.event_name == 'push' && github.event.ref == 'refs/heads/publish'
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
PUBLISH_DIR: public
|
|
|
|
BRANCH: gh-pages
|
|
|
|
run: |
|
|
|
|
cd $PUBLISH_DIR
|
|
|
|
ls -l
|
|
|
|
git init
|
|
|
|
git config user.name "${GITHUB_ACTOR}"
|
|
|
|
git config user.email "${GITHUB_ACTOR}@noreply.github.com"
|
|
|
|
git add .
|
|
|
|
git status
|
|
|
|
git commit -m "Push to gh-pages"
|
|
|
|
git push -f https://$GITHUB_ACTOR:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:$BRANCH
|