Skip to content

Commit

Permalink
Refactor GitHub Actions workflow to deploy Javadocs without committin…
Browse files Browse the repository at this point in the history
…g to the repository

- Removed the `commit-javadoc` job to prevent committing files to the repository.
- Updated the `build-javadoc` job to upload Javadocs as artifacts.
- Modified the `deploy-javadoc` job to deploy using the uploaded artifacts.
- Updated README to reflect the new deployment process.
  • Loading branch information
SableRaf committed Dec 11, 2024
1 parent d7f1d65 commit 90df74e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 37 deletions.
38 changes: 3 additions & 35 deletions .github/workflows/build-and-deploy-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
REMOTE_URL: "https://github.com/processing/processing4.git"

steps:
- name: Checkout gh-pages branch
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: gh-pages
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
Expand Down Expand Up @@ -79,47 +79,15 @@ jobs:
run: |
ant doc
- name: Copy Javadoc to /docs directory
run: |
if [ -d "processing4/build/javadoc/core" ]; then
cp -r processing4/build/javadoc/core ../docs/
fi
- name: Upload Javadocs artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./docs
path: processing4/build/javadoc/core

- name: Clean up the processing4 directory
run: |
rm -rf processing4/
commit-javadoc:
runs-on: ubuntu-latest
needs: build-javadoc

steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
repository: processing/processing4-javadocs
ref: gh-pages
fetch-depth: 0

- name: Commit and Push changes to gh-pages if any changes exist
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
if [ -n "$(git status --porcelain docs/)" ]; then
git add docs/
git commit -m "Update Javadocs"
git push https://[email protected]/processing/processing4-javadocs.git HEAD:gh-pages
else
echo "No changes to commit."
fi
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}

deploy-javadoc:
needs: build-javadoc
permissions:
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ This repository uses a custom GitHub Actions workflow [`build-and-deploy-javadoc

The workflow clones the `processing/processing4` repository, gets the commit corresponding to the latest release, builds the Javadocs using `ant`, and copies the generated files to the `/docs` directory of this repository. The updated Javadocs are then committed and pushed to the `gh-pages` branch.

We've set "Deploy from branch" in the repo settings to trigger on push to the `gh-pages` branch. Every time the `build-and-deploy-javadoc.yml` workflow completes, it will trigger a deploy to GitHub pages.

The workflow is triggered every Monday at midnight (UTC). A maintainer can manually trigger the workflow if needed.

## Legacy
Expand Down

0 comments on commit 90df74e

Please sign in to comment.