CI and deploy steps for docs #38
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: Build & Deploy javadoc | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
branches: | |
# testing only, not allowed to run on OpenLineage/OpenLineage repo | |
- test-docs-deploy | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
generate_javadoc: | |
if: | | |
(github.ref == 'refs/heads/test-docs-deploy' && github.repository != 'OpenLineage/OpenLineage' ) || | |
(github.ref != 'refs/heads/test-docs-deploy' && github.repository == 'OpenLineage/OpenLineage') | |
name: "Generate Java docs" | |
env: | |
branch: ${{ (github.head_ref || github.ref_name) == 'test-docs-deploy' && 'test-docs-deploy' || 'main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '11' | |
- uses: actions/checkout@v4 | |
- name: Generate new java doc | |
run: | | |
cd client/java | |
./gradlew --console=plain javadoc | |
- name: Get git branch | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git fetch | |
git checkout ${{ env.branch }} | |
- name: Clear existing javadoc | |
run: rm -rf website/static/apidocs/javadoc | |
- name: Copy docs to website directory | |
run: cp -r client/java/build/docs/javadoc website/static/apidocs | |
- name: Commit javadoc | |
run: | | |
git pull | |
git add website/static/apidocs/javadoc/ | |
git commit -m "[generated] reloading javadoc" | |
git push | |
site-deploy-changes: | |
uses: ./.github/workflows/site-deploy.yml | |
needs: generate_javadoc | |
with: | |
branch: ${{ (github.head_ref || github.ref_name) == 'test-docs-deploy' && 'test-docs-deploy' || 'main' }} |