-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: migrate to reusable ref docs gh action #152
Open
OmarAlJarrah
wants to merge
2
commits into
main
Choose a base branch
from
OmarAlJarrah/migrate-to-reusable-docs-deploy-gh-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,100 +2,14 @@ name: Deploy Reference Documentation | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: 'Choose the branch/tag/ref to deploy the reference documentation from' | ||
required: true | ||
default: 'main' | ||
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: ${{ inputs.ref }} | ||
|
||
- 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: Checkout "gh-pages" Branch | ||
run: git checkout gh-pages | ||
|
||
- name: Extract and Store Latest Live Docs Version Number | ||
run: echo "LATEST_DOCS_VERSION=$(jq -r '.version' version.json)" >> $GITHUB_ENV | ||
|
||
- name: Move Latest Docs to the "older" Directory (Archiving latest live release) | ||
run: | | ||
mkdir -p older/${{ env.LATEST_DOCS_VERSION }} | ||
mv images -- '-lodging -connectivity -java -s-d-k' scripts styles index.html navigation.html not-found-version.html version.json older/${{ env.LATEST_DOCS_VERSION }} | ||
|
||
- name: Move the "older" and "assets" Directories to a Temporary Workspace | ||
run: mv older assets ${{ runner.temp }} | ||
|
||
- name: Checkout ${{ inputs.ref }} Branch | ||
run: git checkout ${{ inputs.ref }} | ||
|
||
- name: Generate New Release Reference Docs | ||
run: | | ||
gradle -p code dokkaHtml -Pdokka-old-versions.location=${{ runner.temp }}/older -Pdokka-assets.location=${{ runner.temp }}/assets | ||
|
||
- name: Extract and Store Newly Generated Docs Version Number | ||
run: | | ||
echo "NEW_DOCS_VERSION=$(jq -r '.version' code/build/dokka/html/version.json)" >> $GITHUB_ENV | ||
|
||
- name: Check the New Release Version | ||
run: | | ||
for dir in ${{ runner.temp }}/older/*; do | ||
if [ -d "$dir" ]; then | ||
DIR_NAME=$(basename "$dir") | ||
if [ "$DIR_Ngit remote get-url originAME" == "${{ env.NEW_DOCS_VERSION }}" ]; then | ||
echo "Error: Reference Docs with version ${{env.NEW_DOCS_VERSION }} already exists." | ||
echo "Hint: Make sure to update the project version in the pom.xml file" | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
|
||
- name: Move the Newly Generated Docs to a Temporary Workspace | ||
run: mv code/build/dokka/html ${{ runner.temp }}/${{ env.NEW_DOCS_VERSION }} | ||
|
||
- name: Checkout "gh-pages" Branch | ||
run: git checkout gh-pages | ||
|
||
- name: Cleanup Old Docs from the Repository's Root | ||
run: rm -rf code images older -- '-lodging -connectivity -java -s-d-k' scripts styles index.html navigation.html not-found-version.html version.json | ||
|
||
- name: Move Newly Generated Docs to the Repository Root | ||
run: | | ||
rm -rf .gradle | ||
mv ${{ runner.temp }}/${{ env.NEW_DOCS_VERSION }}/* . | ||
|
||
- name: Commit the 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@v7 | ||
with: | ||
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
commit-message: "chore: publish docs for version ${{ env.NEW_DOCS_VERSION }}" | ||
body: "This PR adds the reference documentation for version ${{ env.NEW_DOCS_VERSION }}." | ||
title: "chore: publish docs for version ${{ env.NEW_DOCS_VERSION }}" | ||
branch: "docs-update-${{ env.NEW_DOCS_VERSION }}" | ||
uses: "ExpediaGroup/expediagroup-java-sdk/.github/workflows/generate-ref-docs.yaml@main" | ||
with: | ||
buildsystem: 'gradle' | ||
secrets: | ||
GITHUB_PAT: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this option available.