-
Notifications
You must be signed in to change notification settings - Fork 4
134 lines (116 loc) · 4.06 KB
/
build-and-publish.yaml
File metadata and controls
134 lines (116 loc) · 4.06 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
128
129
130
131
132
133
134
name: Build and Publish
on:
push:
tags: ["**"]
branches:
- master
pull_request:
jobs:
build-and-publish:
name: Java Gradle
uses: bakdata/ci-templates/.github/workflows/java-gradle-library.yaml@1.72.2
with:
java-version: 17
secrets:
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING }}
signing-key-id: ${{ secrets.SONATYPE_SIGNING_KEY_ID }}
signing-password: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
ossrh-username: ${{ secrets.SONATYPE_OSSRH_USERNAME }}
ossrh-password: ${{ secrets.SONATYPE_OSSRH_PASSWORD }}
github-token: ${{ secrets.GH_TOKEN }}
extract-javadoc:
name: Extract Javadoc JARs into docs
runs-on: ubuntu-24.04
needs: build-and-publish
if: ${{ needs.build-and-publish.result == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download aggregated Javadoc artifact
uses: actions/download-artifact@v7
with:
name: build-artifact
path: build-artifact
- name: Extract aggregated Javadoc JAR
shell: bash
run: |
mkdir -p docs/docs/javadoc
jar_path=$(find build-artifact/build/libs -type f -name "*-javadoc.jar" | head -n 1)
if [[ -f "$jar_path" ]]; then
echo "Found aggregated Javadoc JAR: $jar_path"
unzip -q "$jar_path" -d docs/docs/javadoc
echo "Extracted Javadoc to docs/docs/javadoc"
find docs/docs/javadoc
else
echo "No aggregated Javadoc JAR found!"
exit 1
fi
- name: Upload extracted Javadoc
uses: actions/upload-artifact@v6
with:
name: javadoc
path: docs/docs/javadoc
docs:
name: Build Docs
runs-on: ubuntu-24.04
needs: extract-javadoc
if: ${{ needs.extract-javadoc.result == 'success' }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install Poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: "1.8.2"
- name: Install docs dependencies
run: poetry install --no-root
- name: Build docs
run: poetry run mkdocs build -f docs/mkdocs.yml
publish-docs:
name: Publish Docs
runs-on: ubuntu-24.04
needs: docs
if: ${{ needs.docs.result == 'success' }}
permissions:
contents: write # Explicitly grant write access to allow pushing in this job for dependabot
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all tags; Required for doc versioning
- name: Download extracted Javadoc
uses: actions/download-artifact@v7
with:
name: javadoc
path: docs/docs/javadoc
- name: Determine tag
id: get-tag
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "tag=dev" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
elif [[ "${GITHUB_REF_NAME}" == "${{ github.event.repository.default_branch }}" ]]; then
echo "tag=main" >> "$GITHUB_OUTPUT"
fi
- name: Check for docs changes (PR)
if: ${{ github.event_name == 'pull_request' }}
uses: dorny/paths-filter@v3
id: docs-changes
with:
filters: |
docs:
- added|deleted|modified: 'docs/**'
- name: Publish docs
if: ${{ github.event_name != 'pull_request' || steps.docs-changes.outputs.docs == 'true' }}
uses: ./.github/actions/update-docs
with:
username: ${{ secrets.GH_USERNAME }}
email: ${{ secrets.GH_EMAIL }}
token: ${{ secrets.GH_TOKEN }}
tag: ${{ steps.get-tag.outputs.tag }}
release: ${{ github.ref_type == 'tag' }}