Skip to content

Commit 96f9bca

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

File tree

2 files changed

+24
-42
lines changed

2 files changed

+24
-42
lines changed

.github/workflows/docs.yml

Lines changed: 24 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+
dokka_artifact_url:
11+
description: 'URL of 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,21 @@ 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.dokka_artifact_url }}" ]; then
100+
echo "'dokka_artifact_url' is not set"
101+
exit 1
102+
fi
103+
104+
if [ ${{ inputs.dry_run }} == true ]; then
105+
echo "Dry run mode is enabled."
106+
curl -v -s -f -L \
107+
-H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \
108+
${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }}
109+
else
110+
curl -v -s -f -L \
111+
${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }}
112+
fi
97113
98114
- name: Unzip Dokka
99115
run: unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api
@@ -110,7 +126,7 @@ jobs:
110126
retention-days: 7
111127

112128
deploy:
113-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
129+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
114130
environment:
115131
name: github-pages
116132
url: ${{ steps.deployment.outputs.page_url }}
@@ -138,7 +154,7 @@ jobs:
138154
uses: actions/deploy-pages@v4
139155

140156
publish-indexes:
141-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
157+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
142158
needs: [ build, test, assemble, deploy ]
143159
runs-on: ubuntu-latest
144160
container:

.github/workflows/dokka.yml

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

0 commit comments

Comments
 (0)