Skip to content

Commit a699c5d

Browse files
committed
chore: migrate to reusable ref docs gh action
1 parent c9fc1a6 commit a699c5d

File tree

1 file changed

+5
-88
lines changed

1 file changed

+5
-88
lines changed

.github/workflows/generate-docs-site.yml

Lines changed: 5 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -8,91 +8,8 @@ permissions:
88

99
jobs:
1010
deploy-reference-docs:
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- name: Checkout "main" Branch
15-
uses: actions/checkout@v4
16-
with:
17-
ref: main
18-
19-
- name: Setup Java 21
20-
uses: actions/setup-java@v4
21-
with:
22-
distribution: 'corretto'
23-
java-version: '21'
24-
25-
- name: Configure Git
26-
run: |
27-
git config --global user.email "[email protected]"
28-
git config --global user.name "eg-oss-ci"
29-
git fetch --all
30-
31-
- name: Checkout "gh-pages" Branch
32-
run: git checkout gh-pages
33-
34-
- name: Extract and Store Latest Live Docs Version Number
35-
run: echo "LATEST_DOCS_VERSION=$(jq -r '.version' version.json)" >> $GITHUB_ENV
36-
37-
- name: Move Latest Docs to the "older" Directory (Archiving latest live release)
38-
run: |
39-
mkdir older/${{ env.LATEST_DOCS_VERSION }}
40-
mv images rapid-sdk scripts styles index.html navigation.html not-found-version.html version.json older/${{ env.LATEST_DOCS_VERSION }}
41-
42-
- name: Move the "older" and "assets" Directories to a Temporary Workspace
43-
run: mv older assets ${{ runner.temp }}
44-
45-
- name: Checkout "main" Branch
46-
run: git checkout main
47-
48-
- name: Generate New Release Reference Docs
49-
run: mvn -f code dokka:dokka -Ddokka-old-versions.location=${{ runner.temp }}/older -Ddokka-assets.location=${{ runner.temp }}/assets
50-
51-
- name: Extract and Store Newly Generated Docs Version Number
52-
run: echo "NEW_DOCS_VERSION=$(jq -r '.version' code/target/dokka/version.json)" >> $GITHUB_ENV
53-
54-
- name: Check the New Release Version
55-
run: |
56-
for dir in ${{ runner.temp }}/older/*; do
57-
if [ -d "$dir" ]; then
58-
DIR_NAME=$(basename "$dir")
59-
if [ "$DIR_NAME" == "${{ env.NEW_DOCS_VERSION }}" ]; then
60-
echo "Error: Reference Docs with version ${{env.NEW_DOCS_VERSION }} already exists."
61-
echo "Hint: Make sure to update the project version in the pom.xml file"
62-
exit 1
63-
fi
64-
fi
65-
done
66-
67-
- name: Move the Newly Generated Docs to a Temporary Workspace
68-
run: mv code/target/dokka ${{ runner.temp }}/${{ env.NEW_DOCS_VERSION }}
69-
70-
- name: Checkout "gh-pages" Branch
71-
run: git checkout gh-pages
72-
73-
- name: Cleanup Old Docs from the Repository's Root
74-
run: rm -rf code images older rapid-sdk scripts styles ui-kit index.html navigation.html not-found-version.html version.json
75-
76-
- name: Move Newly Generated Docs to the Repository Root
77-
run: mv ${{ runner.temp }}/${{ env.NEW_DOCS_VERSION }}/* .
78-
79-
- name: Commit the New Release
80-
run: |
81-
git add .
82-
git commit -m "chore: publishing docs for version ${{ env.NEW_DOCS_VERSION }}"
83-
84-
- name: Create Pull Request
85-
uses: peter-evans/create-pull-request@v7
86-
with:
87-
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
88-
commit-message: "chore: publishing docs for version ${{ env.NEW_DOCS_VERSION }}"
89-
body: "This PR adds the reference documentation for version ${{ env.NEW_DOCS_VERSION }}."
90-
title: "chore: reference docs update for version ${{ env.NEW_DOCS_VERSION }}"
91-
branch: "docs-update-${{ env.NEW_DOCS_VERSION }}"
92-
93-
94-
95-
96-
97-
98-
11+
uses: ExpediaGroup/expediagroup-java-sdk/.github/workflows/generate-ref-docs.yaml@main
12+
with:
13+
buildsystem: 'maven'
14+
secrets:
15+
GITHUB_PAT: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)