Publish Dokka Docs #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Dokka Docs | ||
| on: | ||
| push: | ||
| branches: | ||
| - ${{ github.event.repository.default_branch }} | ||
|
Check failure on line 6 in .github/workflows/publish-docs.yml
|
||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| pages: write | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| artifact: ${{ steps.define-ids.outputs.artifact }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Define instance id and artifacts | ||
| id: define-ids | ||
| run: | | ||
| ARTIFACT="dokka-docs.zip" | ||
| # Print the values | ||
| echo "artifact=$ARTIFACT" | ||
| # Set the output | ||
| echo "::set-output name=artifact::$ARTIFACT" | ||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v3 | ||
| - name: Build docs using Dokka | ||
| run: ./gradlew dokkaGenerate | ||
| - name: Zip docs | ||
| run: | | ||
| mkdir -p artifacts | ||
| cd build/dokka/html | ||
| zip -r ../../../artifacts/${{ steps.define-ids.outputs.artifact }} . | ||
| - name: Verify zip file | ||
| run: ls -la artifacts/ | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: docs | ||
| path: artifacts/${{ needs.build.outputs.artifact }} | ||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| needs: [build] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download docs | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: docs | ||
| path: artifacts | ||
| - name: Unzip artifact | ||
| run: unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.artifact }}" -d dir | ||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v4 | ||
| - name: Package and upload Pages artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: dir | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||