Deploy Reference Documentation #135
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: | |
inputs: | |
version: | |
description: 'SDK Version' | |
required: true | |
type: string | |
permissions: | |
id-token: write | |
jobs: | |
deploy-reference-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- 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" | |
- name: Checkout gh-pages branch | |
run: | | |
git fetch origin mdwairi/refactor-docs-versioning | |
git checkout mdwairi/refactor-docs-versioning | |
- name: List directories in gh-pages (debug step) | |
run: | | |
echo "Directories in gh-pages branch:" | |
ls -d */ | |
- name: Move latest release to the older directory | |
run: | | |
VERSION=$(jq -r '.version' version.json) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
rsync -av --exclude='older' --exclude='.git' --exclude='README.md' --remove-source-files ./ older/$VERSION/ | |
find . -type d -empty -delete | |
mkdir -p ${{ runner.temp }}/older | |
mv older/* ${{ runner.temp }}/older | |
- name: list older content before checkout | |
run: ls ${{ runner.temp }}/older | |
- name: Checkout to main | |
run: | | |
git fetch --all | |
git checkout mdwairi/support-multimodule-versioning | |
- name: Generate new docs | |
run: | | |
cd code | |
mvn dokka:dokka -Ddokka-old-versions.location=${{ runner.temp }}/older | |
- name: list new content | |
run: ls -a code/target/dokka | |
- name: move from target to temp | |
run: | | |
mv code/target/dokka ${{ runner.temp }}/new-docs | |
- name: checkout to gh-pages | |
run: git checkout mdwairi/refactor-docs-versioning | |
- name: remove old docs | |
run: rm -rf images older rapid-sdk scripts code styles index.html navigation.html not-found-version.html version.json | |
- name: list content after removal | |
run: ls | |
- name: commit new docs | |
run: | | |
mv ${{ runner.temp }}/new-docs/* . | |
ls | |
NEW_DOCS_VERSION=$(jq -r '.version' version.json) | |
echo "NEW_DOCS_VERSION=NEW_DOCS_VERSION" >> $GITHUB_ENV | |
git add . | |
git commit -m "chore: publishing docs for version $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 }}" | |