7
7
- ' .github/workflows/**'
8
8
workflow_dispatch :
9
9
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
12
17
required : true
13
18
14
19
permissions :
@@ -90,10 +95,25 @@ jobs:
90
95
run : unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
91
96
92
97
- 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
+ artifact_url="https://krpc.teamcity.com/app/rest/builds/id:${{ inputs.build_id }}/artifacts/content/${{ env.DOKKA_ARTIFACT }}"
107
+ echo "Downloading Dokka artifact from TC: $artifact_url"
108
+
109
+ curl -v -s -f -L \ ─╯
110
+ -H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \
111
+ $artifact_url -o ${{ env.DOKKA_ARTIFACT }}
112
+
113
+ if [ -z "$(ls | grep -x ${{ env.DOKKA_ARTIFACT }})" ]; then
114
+ echo "Failed to download Dokka artifact, asset id: ${{ inputs.build_id }}"
115
+ exit 1
116
+ fi
97
117
98
118
- name : Unzip Dokka
99
119
run : unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api
@@ -110,7 +130,7 @@ jobs:
110
130
retention-days : 7
111
131
112
132
deploy :
113
- if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
133
+ if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
114
134
environment :
115
135
name : github-pages
116
136
url : ${{ steps.deployment.outputs.page_url }}
@@ -138,7 +158,7 @@ jobs:
138
158
uses : actions/deploy-pages@v4
139
159
140
160
publish-indexes :
141
- if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
161
+ if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
142
162
needs : [ build, test, assemble, deploy ]
143
163
runs-on : ubuntu-latest
144
164
container :
0 commit comments