Skip to content

Publish Dokka Docs

Publish Dokka Docs #19

Workflow file for this run

name: Publish Dokka Docs
on:
push:
branches:
- version/1.21
workflow_dispatch:
permissions:
contents: read
id-token: write
pages: write
env:
PROJECT_NAME: surf-api
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: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy cf-pages --project-name=${{ env.PROJECT_NAME }} --branch=main
wranglerVersion: 3.101.0
# - 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