-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (112 loc) · 3.13 KB
/
docs.yaml
File metadata and controls
127 lines (112 loc) · 3.13 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Publish docs to GitHub Pages
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
# on change to watched file(s)
branches: [main]
paths:
- mkdocs/**
- usajobsapi/**/*.py
- README.md
- CHANGELOG.md
- LICENSE
- CODE_OF_CONDUCT.md
- SECURITY.md
pull_request:
branches: [main] # PR verification only (base=main)
release:
types:
- published
workflow_dispatch:
inputs:
ref:
description: "Branch, tag, or SHA to deploy"
required: false
default: ""
permissions:
contents: read
jobs:
# Build job for PR verification
build:
if: github.event_name == 'pull_request'
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/python-init
- name: Build MkDocs site
run: uv run mkdocs build -f mkdocs/mkdocs.yaml
- uses: ./.github/actions/python-post
publish:
# on release, push to main, or manual dispatch
if: >-
github.repository == 'paddy74/python-usajobsapi' &&
(
(
github.event_name == 'release' &&
github.event.release.prerelease == false &&
github.event.release.draft == false
) ||
(
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
) ||
github.event_name == 'workflow_dispatch'
)
name: Publish docs
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy-pages.outputs.page_url }}
steps:
- name: Check out release tag
if: github.event_name == 'release'
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Check out branch
if: github.event_name == 'push'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Resolve dispatch ref
if: github.event_name == 'workflow_dispatch'
id: dispatch-ref
run: |
ref="$DISPATCH_REF"
if [ -z "$ref" ]; then
if [ -n "$GITHUB_REF" ]; then
ref="$GITHUB_REF"
else
ref="$GITHUB_SHA"
fi
fi
echo "ref=$ref" >> "$GITHUB_OUTPUT"
env:
DISPATCH_REF: ${{ github.event.inputs.ref }}
- name: Check out dispatch ref
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ steps.dispatch-ref.outputs.ref }}
- name: Setup GitHub Pages
uses: actions/configure-pages@v5
- uses: ./.github/actions/python-init
- name: Build static site
run: uv run mkdocs build -f mkdocs/mkdocs.yaml
- uses: ./.github/actions/python-post
- name: Upload site artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
- name: Deploy to GitHub Pages
id: deploy-pages
uses: actions/deploy-pages@v4