Create main.yml
This commit is contained in:
parent
9639408999
commit
7b3b7c0b68
1 changed files with 55 additions and 0 deletions
55
.github/workflows/main.yml
vendored
Normal file
55
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
name: build and deploy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- doc
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: my-branch
|
||||
|
||||
- name: Setup Python 3.9
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirement.txt
|
||||
|
||||
- name: Build with mkdocs
|
||||
run: mkdocs build
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Cache Node Modules
|
||||
id: node-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
- name: Install
|
||||
if: steps.node-cache.outputs.cache-hit != 'true'
|
||||
run: yarn --no-lockfile
|
||||
|
||||
- name: Deploy to server
|
||||
run: node deploy.js
|
||||
env:
|
||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||
REMOTE_PWD: ${{ secrets.REMOTE_PWD }}
|
||||
REMOTE_PATH: ${{ secrets.REMOTE_PATH }}
|
Reference in a new issue