Skip to content

Commit a689b7a

Browse files
committed
feat: support custom slug per docs version
1 parent ad7a552 commit a689b7a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.github/workflows/docs.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@ jobs:
4141
mermaid: "1.0.0"
4242
jinja: "3.1.1"
4343
- version: "wip/alt-comm"
44+
slug: "alt-comm"
4445
source: "heads"
4546
python: "3.12"
4647
sphinx: "8.2.3"
4748
mermaid: "1.0.0"
4849
jinja: "3.1.1"
4950
steps:
50-
- name: 🧾 Log event & matrix
51+
- name: 🧾 Log event & matrix, determine slug
5152
run: |
5253
echo "Event: ${{ github.event_name }} - ${{ toJson(github.event.client_payload) }}"
53-
echo "Matrix: ${{ matrix.version }}, ${{ matrix.source }}, ${{ matrix.python }}, ${{ matrix.mermaid }}"
54+
echo "Matrix: ${{ matrix.version }}, ${{ matrix.slug }}, ${{ matrix.source }}, ${{ matrix.python }}, ${{ matrix.mermaid }}"
5455
echo "Formatted ref: ${{ format('refs/{0}/{1}', matrix.source, matrix.version) }}"
5556
57+
DOC_SLUG="${{ matrix.slug || matrix.version }}"
58+
echo "DOC_SLUG=$DOC_SLUG" >> $GITHUB_ENV
59+
5660
- name: 🛡️ Disable AppArmor
5761
uses: cisagov/action-disable-apparmor@437d94f26a2e4bf8c03acfb500a6afc688b497db # v1.0.0
5862

@@ -117,23 +121,23 @@ jobs:
117121
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event.client_payload.ref == format('refs/{0}/{1}', matrix.source, matrix.version)
118122
run: |
119123
cd ${{ github.workspace }}/docs.octoprint.org/util/versionselector
120-
python versionselector.py ${{ github.workspace }}/OctoPrint/docs/ ${{ matrix.version }} ${{ env.OCTOPRINT_VERSION }} ${{ github.workspace }}/versions.json -D mermaid_cmd=${{ github.workspace }}/node_modules/.bin/mmdc -D mermaid_params="-p${{ github.workspace }}/puppeteer-config.json" -D mermaid_output_format=svg -D mermaid_version=
121-
echo ".rst-content object[type^='image/']{width: 100%;}" >> ${{ github.workspace }}/OctoPrint/docs/_build/html/${{ matrix.version }}/_static/theme_overrides.css
124+
python versionselector.py ${{ github.workspace }}/OctoPrint/docs/ ${{ env.DOC_SLUG }} ${{ env.OCTOPRINT_VERSION }} ${{ github.workspace }}/versions.json -D mermaid_cmd=${{ github.workspace }}/node_modules/.bin/mmdc -D mermaid_params="-p${{ github.workspace }}/puppeteer-config.json" -D mermaid_output_format=svg -D mermaid_version=
125+
echo ".rst-content object[type^='image/']{width: 100%;}" >> ${{ github.workspace }}/OctoPrint/docs/_build/html/${{ env.DOC_SLUG }}/_static/theme_overrides.css
122126
123127
#- name: 🔎 Run link check
124128
# id: lc
125129
# uses: peter-evans/link-checker@v1
126130
# with:
127-
# args: -v -r -d ./OctoPrint/docs/_build/html/${{ matrix.version }} ./OctoPrint/docs/_build/html/${{ matrix.version }}
131+
# args: -v -r -d ./OctoPrint/docs/_build/html/${{ env.DOC_SLUG }} ./OctoPrint/docs/_build/html/${{ env.DOC_SLUG }}
128132
#- name: 🔎 Evaluate link check
129133
# run: exit ${{ steps.lc.outputs.exit_code }}
130134

131135
- name: ⬆ Persist build result
132136
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event.client_payload.ref == format('refs/{0}/{1}', matrix.source, matrix.version)
133137
uses: actions/upload-artifact@v4
134138
with:
135-
name: ${{ matrix.version }}
136-
path: ${{ github.workspace }}/OctoPrint/docs/_build/html/${{ matrix.version }}
139+
name: ${{ env.DOC_SLUG }}
140+
path: ${{ github.workspace }}/OctoPrint/docs/_build/html/${{ env.DOC_SLUG }}
137141

138142
deploy:
139143
name: Deploy docs

util/versions_from_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
versions = dict()
2323
for version in matrix:
24-
name = version["version"]
24+
name = version.get("slug", version["version"])
2525
source = version["source"]
2626
print("Adding {}/{} to versions.json".format(name, source))
2727

0 commit comments

Comments
 (0)