-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (48 loc) · 1.57 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Publish JD
on: ["pull_request", "push"]
env:
DEST_DIR: _out
PYTHON_VERSION: "3.10"
concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
runs-on: "ubuntu-latest"
steps:
- name: "checkout repository"
uses: "actions/checkout@v4"
- name: "setup python ${{ env.PYTHON_VERSION }}"
uses: "actions/setup-python@v5"
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: "install dependencies"
run: |
pip install poetry
pushd _generator
poetry install
- name: "generate site"
run: |
pushd _generator
poetry run generate-jd ../$DEST_DIR --metadata ../metadata.yaml --jd-root ..
- name: "publish"
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
uses: "actions/upload-pages-artifact@v3"
with:
path: "${{ env.DEST_DIR }}"
deploy:
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
needs: "build"
runs-on: "ubuntu-latest"
permissions:
pages: "write"
id-token: "write"
environment:
name: "github-pages"
url: "${{ steps.deployment.outputs.page_url }}"
steps:
- name: "Deploy to GitHub pages"
id: "deployment"
uses: "actions/deploy-pages@v4"