Skip to content

Commit

Permalink
Deploy Dokka documentation on GitHub Pages and Netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Jan 3, 2025
1 parent 310668d commit 769787a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 49 deletions.
55 changes: 14 additions & 41 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ on:
- labeled
- unlabeled

env:
INSTANCE: 'docs/oad'
ARTIFACT: 'webHelpOAD2-all.zip'
DOCKER_VERSION: '241.18775'

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -29,60 +24,40 @@ jobs:
with:
fetch-depth: 0

- name: Build docs using Writerside Docker builder
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.INSTANCE }}
artifact: ${{ env.ARTIFACT }}
docker-version: ${{ env.DOCKER_VERSION }}
- name: Build documentation with Dokka
run: ./gradlew dokkaGenerate

- name: Save artifact with build results
- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: |
artifacts/${{ env.ARTIFACT }}
artifacts/report.json
retention-days: 7

test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: docs
path: artifacts

- name: Test documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: ${{ env.INSTANCE }}
path: docs/dokka

github-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: [ build, test ]
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: docs

- name: Unzip artifact
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d dir
path: docs

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Package and upload Pages artifact
uses: actions/[email protected]
with:
path: dir
path: docs

- name: Deploy to GitHub Pages
id: deployment
Expand All @@ -92,7 +67,7 @@ jobs:
environment:
name: netlify
url: ${{ steps.deployment.outputs.deploy_preview_url }}
needs: [ build, test ]
needs: build
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.ref != 'refs/heads/master'
steps:
Expand All @@ -112,9 +87,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: docs

- name: Unzip artifact
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d dir
path: docs

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -131,7 +104,7 @@ jobs:
# This value is unset if workflow has not been triggered by a pull request, use GITHUB_SHA instead
BRANCH_SHA=${{ github.event.pull_request.head.sha }}
COMMIT_SHA=${BRANCH_SHA:-$GITHUB_SHA}
./gradlew publishDocumentationToNetlify -PdocumentationPath=dir -PnetlifySiteId=${{ secrets.NETLIFY_SITE_ID }} -PnetlifyToken=${{ secrets.NETLIFY_TOKEN }} -PcommitSha=$COMMIT_SHA
./gradlew publishDocumentationToNetlify -PdocumentationPath=docs -PnetlifySiteId=${{ secrets.NETLIFY_SITE_ID }} -PnetlifyToken=${{ secrets.NETLIFY_TOKEN }} -PcommitSha=$COMMIT_SHA
# Set environment URL
echo deploy_preview_url=$(cat netlify_deploy_preview_url.txt) >> $GITHUB_OUTPUT
env:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
COMMIT_SHA=${BRANCH_SHA:-$GITHUB_SHA}
./gradlew assembleProd -PversionNameSuffix="-${COMMIT_SHA::7}" -PversionCode=$GITHUB_RUN_NUMBER --stacktrace
- name: Store tests artifacts
- name: Upload tests artifacts
if: always()
uses: actions/upload-artifact@v4
with:
Expand All @@ -74,43 +74,43 @@ jobs:
core/build/reports/androidTests
core/build/reports/tests
- name: Store app artifacts
- name: Upload app artifacts
uses: actions/upload-artifact@v4
with:
name: app
path: app/build/outputs/apk/*/*/*.apk

- name: Store core artifacts
- name: Upload core artifacts
uses: actions/upload-artifact@v4
with:
name: core
path: core/build/outputs/aar/*.aar

- name: Store foundation artifacts
- name: Upload foundation artifacts
uses: actions/upload-artifact@v4
with:
name: foundation
path: foundation/build/outputs/aar/*.aar

- name: Store global-raw-tokens artifacts
- name: Upload global-raw-tokens artifacts
uses: actions/upload-artifact@v4
with:
name: global-raw-tokens
path: global-raw-tokens/build/outputs/aar/*.aar

- name: Store theme-contract artifacts
- name: Upload theme-contract artifacts
uses: actions/upload-artifact@v4
with:
name: theme-contract
path: theme-contract/build/outputs/aar/*.aar

- name: Store theme-orange artifacts
- name: Upload theme-orange artifacts
uses: actions/upload-artifact@v4
with:
name: theme-orange
path: theme-orange/build/outputs/aar/*.aar

- name: Store theme-white-label artifacts
- name: Upload theme-white-label artifacts
uses: actions/upload-artifact@v4
with:
name: theme-white-label
Expand Down

0 comments on commit 769787a

Please sign in to comment.