Skip to content
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

Dev #43

Closed
wants to merge 4 commits into from
Closed

Dev #43

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 20 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

permissions:
pages: write # Grant permission to deploy to GitHub Pages
id-token: write # Required for GitHub Pages deployment

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -26,7 +30,8 @@ jobs:

javadoc:
runs-on: ubuntu-latest
needs: test # Ensures the javadoc phase runs only after the test phase succeeds
needs: test # Ensures the javadoc job runs after tests pass

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -38,46 +43,21 @@ jobs:
java-version: '17'

- name: Generate Javadoc
run: mvn javadoc:javadoc --no-transfer-progress -DadditionalJOption=-Xdoclint:none # Ignore warnings
run: mvn javadoc:javadoc --no-transfer-progress

- name: Verify Javadoc
run: |
if [ -d target/site/apidocs ]; then
echo "Javadoc generated successfully."
else
echo "Javadoc failed to generate!"
exit 1
fi

update-docs:
runs-on: ubuntu-latest
needs: [test, javadoc] # This ensures that deploy phase runs only after both test and javadoc phases succeed
if: github.event.pull_request.merged == true # Ensures this runs only when the PR is merged
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up SSH for deploy key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan github.com >> ~/.ssh/known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock

- name: Generate Javadoc
run: mvn javadoc:javadoc --no-transfer-progress
if [ -d docs/apidocs ]; then
echo "Javadoc generated successfully."
else
echo "Javadoc failed to generate!"
exit 1
fi

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs'

- name: Deploy docs to GitHub Pages
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin [email protected]:${{ github.repository }}.git
rm -rf docs/apidocs
mv target/site/apidocs docs/apidocs
git add docs/apidocs
git commit -m "Update Javadoc"
git push origin main
env:
GIT_SSH_COMMAND: "ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes"
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4 # GitHub Pages deploy action
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@
<version>3.4.1</version>
<configuration>
<show>private</show>
<reportOutputDirectory>./docs</reportOutputDirectory>
<outputDirectory>./docs</outputDirectory>
<groups>
<group>
<title>common</title>
Expand Down
Loading