Skip to content

Commit 7683428

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

File tree

2 files changed

+27
-42
lines changed

2 files changed

+27
-42
lines changed

.github/workflows/docs.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ 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: |
17+
Dry run
18+
If set to true, the action will not actually publish the pages, but will assemble the artifact.
19+
default: true
1220
required: true
1321

1422
permissions:
@@ -90,10 +98,21 @@ jobs:
9098
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
9199

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

112131
deploy:
113-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
132+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
114133
environment:
115134
name: github-pages
116135
url: ${{ steps.deployment.outputs.page_url }}
@@ -138,7 +157,7 @@ jobs:
138157
uses: actions/deploy-pages@v4
139158

140159
publish-indexes:
141-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
160+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
142161
needs: [ build, test, assemble, deploy ]
143162
runs-on: ubuntu-latest
144163
container:

.github/workflows/dokka.yml

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

0 commit comments

Comments
 (0)