mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 17:15:05 +08:00
51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
name: Build Upload Site
|
|
|
|
on:
|
|
push:
|
|
branches: [master, dev]
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- name: Cache Packages
|
|
id: yarn-cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install and build
|
|
run: |
|
|
yarn install
|
|
yarn build
|
|
|
|
- name: Get Site ID
|
|
if: ${{ GITHUB_REF#refs/heads/ }} == "master"
|
|
run: |
|
|
echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
|
|
echo "::set-env name=SITE_ID::${{ secrets.PROD_SITE_ID }}"
|
|
|
|
- name: Get Site ID
|
|
if: ${{ GITHUB_REF#refs/heads/ }} == "dev"
|
|
run: |
|
|
echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
|
|
echo "::set-env name=SITE_ID::${{ secrets.DEV_SITE_ID }}"
|
|
|
|
- name: Publish
|
|
uses: netlify/actions/cli@master
|
|
with:
|
|
args: deploy --dir=docs/.vuepress/dist --prod --message="Production ${BRANCH_NAME}@${{ github.event.push.after }}"
|
|
env:
|
|
NETLIFY_SITE_ID: $SITE_ID
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|