diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 300001e68..ac7738f94 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,8 +7,13 @@ on: - '.github/workflows/**' workflow_dispatch: inputs: - version: - description: 'Version of library that is being documented' + dokka_artifact_url: + description: 'URL of Dokka artifact.' + required: true + dry_run: + type: boolean + description: 'If set to true, the action will not actually publish the pages, but will assemble the artifact.' + default: true required: true permissions: @@ -90,10 +95,21 @@ jobs: run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }} - name: Download Dokka - uses: actions/download-artifact@v4 - with: - name: dokka-${{ inputs.version }} - path: ${{ env.DOKKA_ARTIFACT }} + run: | + if [ -z "${{ inputs.dokka_artifact_url }}" ]; then + echo "'dokka_artifact_url' is not set" + exit 1 + fi + + if [ ${{ inputs.dry_run }} == true ]; then + echo "Dry run mode is enabled." + curl -v -s -f -L \ + -H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \ + ${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }} + else + curl -v -s -f -L \ + ${{ inputs.dokka_artifact_url }} -o ${{ env.DOKKA_ARTIFACT }} + fi - name: Unzip Dokka run: unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api @@ -110,7 +126,7 @@ jobs: retention-days: 7 deploy: - if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -138,7 +154,7 @@ jobs: uses: actions/deploy-pages@v4 publish-indexes: - if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run needs: [ build, test, assemble, deploy ] runs-on: ubuntu-latest container: diff --git a/.github/workflows/dokka.yml b/.github/workflows/dokka.yml deleted file mode 100644 index 350d2d6c5..000000000 --- a/.github/workflows/dokka.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Store Dokka Artifact - -on: - workflow_dispatch: - inputs: - version: - description: 'Version of library that is being documented' - required: true - type: string - buildId: - description: 'TeamCity build id' - required: true - type: string - artifactName: - description: 'Name of artifact to download' - required: true - type: string - -jobs: - store-dokka-artifact: - name: Store Dokka Artifact - runs-on: ubuntu-latest - steps: - - name: Download Dokka artifact - run: | - curl -v -s -f -L \ - -H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \ - https://krpc.teamcity.com/app/rest/builds/id:${{ inputs.buildId }}/artifacts/content/${{ inputs.artifactName }} -o dokka.zip - - name: Save artifact - uses: actions/upload-artifact@v4 - with: - name: dokka-${{ inputs.version }} - path: dokka.zip - retention-days: 21