Skip to content

Commit 3fd9048

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

File tree

2 files changed

+25
-42
lines changed

2 files changed

+25
-42
lines changed

.github/workflows/docs.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ 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+
name: 'Dry run'
16+
description: 'If set to true, the action will not actually publish the pages, but will assemble the artifact.'
17+
default: true
1218
required: true
1319

1420
permissions:
@@ -90,10 +96,21 @@ jobs:
9096
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
9197

9298
- name: Download Dokka
93-
uses: actions/download-artifact@v4
94-
with:
95-
name: dokka-${{ inputs.version }}
96-
path: ${{ env.DOKKA_ARTIFACT }}
99+
run: |
100+
if [ -z "${{ inputs.dokka_artifact_url }}" ]; then
101+
echo "'dokka_artifact_url' is not set"
102+
exit 1
103+
fi
104+
105+
if [ ${{ inputs.dry_run }} == true ]; then
106+
echo "Dry run mode is enabled."
107+
curl -v -s -f -L \
108+
-H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \
109+
${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }}
110+
else
111+
curl -v -s -f -L \
112+
${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }}
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.

0 commit comments

Comments
 (0)