Deploy Reference Documentation #139
Workflow file for this run
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: Deploy Reference Documentation | |
on: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
jobs: | |
deploy-reference-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout "main" Branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '21' | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "eg-oss-ci" | |
git fetch --all | |
- name: Configure "shopt" to Enable Extended Patterns Matching | |
run: shopt -s extglob | |
- name: Checkout "gh-pages" Branch | |
run: git checkout mdwairi/refactor-docs-versioning | |
- name: Store and Extract Latest Docs Version Number | |
run: echo "LATEST_DOCS_VERSION=$(jq -r '.version' version.json)" >> $GITHUB_ENV | |
- name: Store Dokka's Files and Directories Names | |
run: | | |
MULTI_VERSIONS_DOKKA_FILES="images|older|rapid-sdk|scripts|styles|index.html|navigation.html|not-found-version.html|version.json" | |
SINGLE_VERSION_DOKKA_FILES="images|rapid-sdk|scripts|styles|index.html|navigation.html|not-found-version.html|version.json" | |
echo "MULTI_VERSIONS_DOKKA_FILES=$MULTI_VERSIONS_DOKKA_FILES" >> $GITHUB_ENV | |
echo "SINGLE_VERSION_DOKKA_FILES=$SINGLE_VERSION_DOKKA_FILES" >> $GITHUB_ENV | |
- name: Move Latest Docs to "older" Directory | |
run: mkdir older/${{ env.LATEST_DOCS_VERSION }} && mv (${{ env.SINGLE_VERSION_DOKKA_FILES }}) older/${{ env.LATEST_DOCS_VERSION }} | |
- name: Move "older" Directory to Temporary Workspace | |
run: mv older ${{ runner.temp }} | |
- name: Checkout "main" Branch | |
run: git checkout mdwairi/support-multimodule-versioning | |
- name: Generate New Release Reference Docs | |
run: mvn -f code dokka:dokka -Ddokka-old-versions.location=${{ runner.temp }}/older | |
- name: Store and Extract Newly Generated Docs Version Number | |
run: echo "NEW_DOCS_VERSION=$(jq -r '.version' version.json)" >> $GITHUB_ENV | |
- name: Move Newly Generated Docs to Temporary Workspace | |
run: mv code/target/dokka ${{ runner.temp }}/${{ env.NEW_DOCS_VERSION }} | |
- name: Checkout "gh-pages" Branch | |
run: git checkout mdwairi/refactor-docs-versioning | |
- name: Cleanup Old Docs from Repository Root | |
run: rm -rf (${{ env.MULTI_VERSIONS_DOKKA_FILES }}) | |
- name: list content after removal | |
run: ls | |
- name: Move Newly Generated Docs to the Repository Root | |
run: mv ${{ runner.temp }}/${{ env.NEW_DOCS_VERSION }}/* . | |
- name: inspect final repo shape | |
run: | | |
ls | |
echo "#####" | |
ls older | |
echo "#####" | |
ls older/3.2.2 | |
- name: Commit New Release | |
run: | | |
git add . | |
git commit -m "chore: publishing docs for version ${{ env.NEW_DOCS_VERSION }}" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
commit-message: "chore: publishing docs for version ${{ env.NEW_DOCS_VERSION }}" | |
body: "This PR adds the reference documentation for version ${{ env.NEW_DOCS_VERSION }}." | |
title: "chore: reference docs update for version ${{ env.NEW_DOCS_VERSION }}" | |
branch: "docs-update-${{ env.NEW_DOCS_VERSION }}" | |