Publish Site #11
This file contains 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 Site | |
on: | |
workflow_dispatch: | |
inputs: | |
checkout-ref: | |
description: "The branch, tag or SHA to checkout. See actions/checkout 'ref'." | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
checkout-ref: | |
description: "The branch, tag or SHA to checkout. See actions/checkout 'ref'." | |
required: false | |
type: string | |
concurrency: | |
group: "Publish Site: ${{ github.workflow }}" | |
cancel-in-progress: true | |
jobs: | |
build-site: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.checkout-ref || github.ref }} | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-home-cache-cleanup: true | |
# write build cache on 'main' and 'release' branches, or tags (default is 'main' only) | |
cache-read-only: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release') && !startsWith(github.ref, 'refs/tags/') }} | |
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
- name: Build site | |
run: ./gradlew :modules:docs:docusaurusBuild | |
- name: Upload site to Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./modules/docs/site/build/ | |
deploy: | |
needs: | |
- build-site | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |