From feace48a0b3c8ee4b40d1e2049472eb9e13ddcb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20de=20Courville?= Date: Wed, 11 Dec 2024 13:11:36 +0100 Subject: [PATCH] Refactor Javadoc deployment workflow to separate fetching, building, and committing steps --- .../workflows/build-and-deploy-javadoc.yml | 63 ++++++++++++------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-and-deploy-javadoc.yml b/.github/workflows/build-and-deploy-javadoc.yml index fe23419..45c2cda 100644 --- a/.github/workflows/build-and-deploy-javadoc.yml +++ b/.github/workflows/build-and-deploy-javadoc.yml @@ -1,4 +1,4 @@ -name: Build And Commit Javadoc +name: Update Javadoc on: schedule: @@ -6,34 +6,13 @@ on: workflow_dispatch: jobs: - build-and-commit-javadoc: + fetch-latest-release: runs-on: ubuntu-latest env: REPO: "processing/processing4" - REMOTE_URL: "https://github.com/processing/processing4.git" steps: - - name: Checkout gh-pages branch - uses: actions/checkout@v3 - with: - ref: gh-pages - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'adopt' - java-version: '17' - - - name: Ensure Ant is installed - run: | - if ! command -v ant &> /dev/null; then - echo "Ant not found, installing..." - sudo apt-get update && sudo apt-get install -y ant - else - echo "Ant is already installed" - fi - - name: Get the latest release tag and commit SHA id: get-commit-sha run: | @@ -61,6 +40,34 @@ jobs: echo "Commit SHA: $commit_sha" echo "commit_sha=$commit_sha" >> $GITHUB_ENV + build-javadoc: + runs-on: ubuntu-latest + needs: fetch-latest-release + + env: + REMOTE_URL: "https://github.com/processing/processing4.git" + + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v3 + with: + ref: gh-pages + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '17' + + - name: Ensure Ant is installed + run: | + if ! command -v ant &> /dev/null; then + echo "Ant not found, installing..." + sudo apt-get update && sudo apt-get install -y ant + else + echo "Ant is already installed" + fi + - name: Fetch and checkout the specific commit run: | git init processing4 @@ -84,6 +91,16 @@ jobs: run: | rm -rf processing4/ + commit-javadoc: + runs-on: ubuntu-latest + needs: build-javadoc + + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v3 + with: + ref: gh-pages + - name: Commit and Push changes to gh-pages if any changes exist run: | git config --global user.name "GitHub Actions"