Skip to content

Commit 351d669

Browse files
committed
Updated CI for automated publications (#373)
1 parent 53538f5 commit 351d669

File tree

3 files changed

+26
-43
lines changed

3 files changed

+26
-43
lines changed

.github/workflows/docs.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ on:
77
- '.github/workflows/**'
88
workflow_dispatch:
99
inputs:
10-
version:
11-
description: 'Version of library that is being documented'
10+
build_id:
11+
description: 'Id of TeamCity build that produced the Dokka artifact.'
12+
required: true
13+
dry_run:
14+
type: boolean
15+
description: "Dry run. If set to true, the action will not actually publish the pages, but will assemble the artifact."
16+
default: true
1217
required: true
1318

1419
permissions:
@@ -90,10 +95,22 @@ jobs:
9095
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
9196

9297
- name: Download Dokka
93-
uses: actions/download-artifact@v4
94-
with:
95-
name: dokka-${{ inputs.version }}
96-
path: ${{ env.DOKKA_ARTIFACT }}
98+
run: |
99+
if [ -z "${{ inputs.build_id }}" ]; then
100+
echo "'build_id' is not set"
101+
exit 1
102+
fi
103+
104+
echo "Downloading Dokka artifact, build id: ${{ inputs.build_id }}"
105+
106+
curl -v -s -f -L \ ─╯
107+
-H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \
108+
"https://krpc.teamcity.com/app/rest/builds/id:${{ inputs.build_id }}/artifacts/content/${{ env.DOKKA_ARTIFACT }}" -o ${{ env.DOKKA_ARTIFACT }}
109+
110+
if [ -z "$(ls | grep -x ${{ env.DOKKA_ARTIFACT }})" ]; then
111+
echo "Failed to download Dokka artifact, asset id: ${{ inputs.build_id }}"
112+
exit 1
113+
fi
97114
98115
- name: Unzip Dokka
99116
run: unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api
@@ -110,7 +127,7 @@ jobs:
110127
retention-days: 7
111128

112129
deploy:
113-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
130+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
114131
environment:
115132
name: github-pages
116133
url: ${{ steps.deployment.outputs.page_url }}
@@ -138,7 +155,7 @@ jobs:
138155
uses: actions/deploy-pages@v4
139156

140157
publish-indexes:
141-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
158+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
142159
needs: [ build, test, assemble, deploy ]
143160
runs-on: ubuntu-latest
144161
container:

.github/workflows/dokka.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

updateSitemap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ current_date=$(date +%Y-%m-%d)
3232
temp_file=$(mktemp)
3333

3434
# Extract the first line from sitemap file (XML header), removing closing urlset tag if present
35-
head -n 1 "$sitemap_file" | sed -En 's/<\/urlset>//' > "$temp_file"
35+
head -n 1 "$sitemap_file" | sed -En 's/<\/urlset>//p' > "$temp_file"
3636

3737
# Find all HTML files in the API docs directory recursively
3838
find "$api_docs_dir" -type f -name "*.html" | while read -r html_file; do

0 commit comments

Comments
 (0)