Skip to content

Commit 40d392f

Browse files
committed
Updated CI for automated publications
1 parent 53538f5 commit 40d392f

File tree

2 files changed

+23
-42
lines changed

2 files changed

+23
-42
lines changed

.github/workflows/docs.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ on:
77
- '.github/workflows/**'
88
workflow_dispatch:
99
inputs:
10-
version:
11-
description: 'Version of library that is being documented'
10+
dokka_artifact_url:
11+
description: 'URL of Dokka artifact.'
12+
required: true
13+
dry_run:
14+
type: boolean
15+
description: 'If set to true, the action will not actually publish the pages, but will assemble the artifact. Default is false.'
1216
required: true
1317

1418
permissions:
@@ -90,10 +94,21 @@ jobs:
9094
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
9195

9296
- name: Download Dokka
93-
uses: actions/download-artifact@v4
94-
with:
95-
name: dokka-${{ inputs.version }}
96-
path: ${{ env.DOKKA_ARTIFACT }}
97+
run: |
98+
if [ -z "${{ inputs.dokka_artifact_url }}" ]; then
99+
echo "'dokka_artifact_url' is not set"
100+
exit 1
101+
fi
102+
103+
if [ ${{ inputs.dry_run }} == true ]; then
104+
echo "Dry run mode is enabled."
105+
curl -v -s -f -L \
106+
-H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \
107+
${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }}
108+
else
109+
curl -v -s -f -L \
110+
${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }}
111+
fi
97112
98113
- name: Unzip Dokka
99114
run: unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api
@@ -110,7 +125,7 @@ jobs:
110125
retention-days: 7
111126

112127
deploy:
113-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
128+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
114129
environment:
115130
name: github-pages
116131
url: ${{ steps.deployment.outputs.page_url }}
@@ -138,7 +153,7 @@ jobs:
138153
uses: actions/deploy-pages@v4
139154

140155
publish-indexes:
141-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
156+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
142157
needs: [ build, test, assemble, deploy ]
143158
runs-on: ubuntu-latest
144159
container:

.github/workflows/dokka.yml

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

0 commit comments

Comments
 (0)