Archived
1
0
Fork 0

Create main.yml

This commit is contained in:
Dianliang233 2021-02-02 22:51:00 +08:00 committed by GitHub
parent 9639408999
commit 7b3b7c0b68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

55
.github/workflows/main.yml vendored Normal file
View 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 }}