Created
February 10, 2025 22:27
-
-
Save bsautner/6a34af233d2f073d67e10c24cc98e963 to your computer and use it in GitHub Desktop.
Github Action for deploying writeside docs with kodda html
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: CI and Documentation Deployment | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
env: | |
INSTANCE: 'Writerside/k' | |
DOCKER_VERSION: '243.22562' | |
jobs: | |
build: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
outputs: | |
algolia_artifact: ${{ steps.define-ids.outputs.algolia_artifact }} | |
artifact: ${{ steps.define-ids.outputs.artifact }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: Build with Gradle (includes Dokka) | |
run: ./gradlew build dokkaGenerate | |
- name: Define instance id and artifacts | |
id: define-ids | |
run: | | |
INSTANCE=${INSTANCE#*/} | |
INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]') | |
ARTIFACT="webHelp${INSTANCE_ID_UPPER}2-all.zip" | |
ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip" | |
echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV | |
echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV | |
echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV | |
echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT | |
echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT | |
- name: Copy Dokka HTML to api-docs | |
run: | | |
mkdir -p Writerside/api-docs | |
if [ -d "api/build/dokka/html" ]; then | |
cp -rv api/build/dokka/html/* Writerside/api-docs/ | |
else | |
echo "Dokka output directory not found!" | |
exit 1 | |
fi | |
ls -la . | |
ls Writerside/api-docs | |
- name: Print Folder Tree | |
uses: jaywcjlove/github-action-folder-tree@main | |
with: | |
exclude: "node_modules|dist|.git|.husky" | |
path: . | |
depth: 5 | |
- name: Build Writerside documentation | |
uses: JetBrains/writerside-github-action@v4 | |
with: | |
instance: ${{ env.INSTANCE }} | |
docker-version: ${{ env.DOCKER_VERSION }} | |
- name: Setup GitHub Pages | |
uses: actions/configure-pages@v4 | |
- name: Package and upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: Writerside | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment