2021-12-02 03:17:10 +08:00
|
|
|
name: Release
|
2020-09-30 19:12:44 +08:00
|
|
|
|
|
|
|
on:
|
2021-12-02 03:17:10 +08:00
|
|
|
workflow_dispatch:
|
2020-09-30 19:12:44 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
2021-12-02 03:17:10 +08:00
|
|
|
ref: master
|
2020-09-30 19:12:44 +08:00
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2022-01-08 16:49:50 +08:00
|
|
|
python-version: "3.9"
|
2020-09-30 19:12:44 +08:00
|
|
|
architecture: "x64"
|
|
|
|
|
2021-12-30 23:29:32 +08:00
|
|
|
- uses: Gr1N/setup-poetry@v7
|
2021-01-18 14:43:06 +08:00
|
|
|
|
2021-12-30 23:29:32 +08:00
|
|
|
- uses: actions/cache@v2
|
2021-01-18 14:43:06 +08:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2021-11-22 23:31:03 +08:00
|
|
|
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
|
2021-01-18 14:43:06 +08:00
|
|
|
|
2021-12-02 14:03:06 +08:00
|
|
|
- name: Setup Node
|
2021-12-30 23:29:32 +08:00
|
|
|
uses: actions/setup-node@v2
|
2021-12-02 14:03:06 +08:00
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
|
|
|
- name: Cache Packages
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
|
2021-01-18 14:43:06 +08:00
|
|
|
- name: Set up dependencies
|
2020-09-30 19:12:44 +08:00
|
|
|
run: |
|
2021-02-06 10:54:50 +08:00
|
|
|
poetry install -E all
|
2020-09-30 19:12:44 +08:00
|
|
|
|
|
|
|
- name: Build Doc
|
|
|
|
run: poetry run sphinx-build -M markdown ./docs_build ./build
|
|
|
|
|
|
|
|
- name: Copy Files
|
2021-12-02 03:17:10 +08:00
|
|
|
run: cp -r ./build/markdown/* ./website/docs/api/
|
2020-09-30 19:12:44 +08:00
|
|
|
|
2021-12-02 03:17:10 +08:00
|
|
|
- name: Archive Files
|
2021-12-02 14:03:06 +08:00
|
|
|
run: |
|
|
|
|
yarn install
|
2021-12-02 15:12:36 +08:00
|
|
|
yarn prettier
|
2021-12-02 14:03:06 +08:00
|
|
|
yarn archive $(poetry version -s)
|
2021-12-02 03:17:10 +08:00
|
|
|
|
|
|
|
- name: Push Tag and Release to PyPI
|
|
|
|
run: |
|
|
|
|
git config user.name github-actions
|
|
|
|
git config user.email github-actions@github.com
|
|
|
|
git add .
|
|
|
|
git commit -m ":bookmark: Release $(poetry version -s)"
|
|
|
|
git tag v$(poetry version -s)
|
2022-01-08 16:49:50 +08:00
|
|
|
git push --follow-tags
|
2021-12-02 03:17:10 +08:00
|
|
|
poetry build
|
|
|
|
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}
|