From a14993186d5f1b2bf03b5b68b0f1e6147f3ae5b9 Mon Sep 17 00:00:00 2001 From: chewiebug Date: Sat, 23 May 2026 16:11:51 +0200 Subject: [PATCH 1/2] fix DRY_RUN during github action runs --- .agents/skills/ci-act-run/SKILL.md | 17 +++---- .clinerules/workflows/ci-build-dry-run.md | 44 ------------------- .gitattributes | 2 +- .github/workflows/build-and-deploy.yaml | 4 +- ...d-and-deploy-snapshot-release-workflow.bat | 2 +- 5 files changed, 13 insertions(+), 56 deletions(-) delete mode 100644 .clinerules/workflows/ci-build-dry-run.md diff --git a/.agents/skills/ci-act-run/SKILL.md b/.agents/skills/ci-act-run/SKILL.md index e9ee6457..027c434e 100644 --- a/.agents/skills/ci-act-run/SKILL.md +++ b/.agents/skills/ci-act-run/SKILL.md @@ -10,7 +10,7 @@ compatibility: opencode - Supports two build paths selectable at runtime: - **pull_request** — simulates a PR build: `act pull_request` sets `CI_IS_PR=true` → script runs `perform_verify()`. - **develop snapshot** — simulates a push to the develop branch: `act push` with `GITHUB_REF_NAME=develop`, `CI_IS_PR=false`, `CI_BRANCH=develop` → script runs `perform_snapshot_release()`. -- `DRY_RUN` is configurable (default `true`). With `DRY_RUN=true`, no actual deploys or pushes are made — safe for local testing. +- `DRY_RUN` is configurable via the GitHub repository variable `DRY_RUN` (default `true`). With `DRY_RUN=true`, no actual deploys or pushes are made — safe for local testing. - The archive step is automatically skipped because the workflow guards it with `!env.ACT`. - Uses the Docker image already configured in `.actrc`: `catthehacker/ubuntu:full-latest`. @@ -118,14 +118,15 @@ If the user selects anything other than `all`, append `--matrix java:` Run the appropriate command from the repo root based on the choices made in steps 3, 4, and 5. -> **REMINDER:** When `DRY_RUN=true`, do NOT include `--secret GITHUB_TOKEN=` — it causes the run to fail. +> **REMINDER:** Use `--var DRY_RUN=true/false` instead of `--env DRY_RUN=true/false`. The workflow reads DRY_RUN from the GitHub repository variable (`${{ vars.DRY_RUN }}`) via the `--var` flag in `act`. `--env` is overridden by the workflow's `env` block and has no effect. +> When `DRY_RUN=true`, do NOT include `--secret GITHUB_TOKEN=` — it causes the run to fail. > When `DRY_RUN=false`, secrets are read from `.env` via `--secret-file .env`. Ensure the file exists at the project root with all required values before running. #### pull_request + DRY_RUN=true (default, safe) ```bash act pull_request \ -W .github/workflows/build-and-deploy.yaml \ - --env DRY_RUN=true \ + --var DRY_RUN=true \ --secret ENCRYPTION_PASSWORD=dummy \ --secret CI_DEPLOY_USERNAME=dummy \ --secret CI_DEPLOY_PASSWORD=dummy \ @@ -137,7 +138,7 @@ act pull_request \ act pull_request \ -W .github/workflows/build-and-deploy.yaml \ --matrix java:17 \ - --env DRY_RUN=true \ + --var DRY_RUN=true \ --secret ENCRYPTION_PASSWORD=dummy \ --secret CI_DEPLOY_USERNAME=dummy \ --secret CI_DEPLOY_PASSWORD=dummy \ @@ -148,7 +149,7 @@ act pull_request \ ```bash act pull_request \ -W .github/workflows/build-and-deploy.yaml \ - --env DRY_RUN=false \ + --var DRY_RUN=false \ --secret GITHUB_TOKEN= \ --secret ENCRYPTION_PASSWORD= \ --secret CI_DEPLOY_USERNAME= \ @@ -160,7 +161,7 @@ act pull_request \ ```bash act push \ -W .github/workflows/build-and-deploy.yaml \ - --env DRY_RUN=true \ + --var DRY_RUN=true \ --env GITHUB_REF_NAME=develop \ --secret ENCRYPTION_PASSWORD=dummy \ --secret CI_DEPLOY_USERNAME=dummy \ @@ -173,7 +174,7 @@ act push \ act push \ -W .github/workflows/build-and-deploy.yaml \ --matrix java:17 \ - --env DRY_RUN=true \ + --var DRY_RUN=true \ --env GITHUB_REF_NAME=develop \ --secret ENCRYPTION_PASSWORD=dummy \ --secret CI_DEPLOY_USERNAME=dummy \ @@ -187,7 +188,7 @@ Uses `--secret-file .env`. For snapshot builds, only `CI_DEPLOY_USERNAME`, `CI_D act push \ -W .github/workflows/build-and-deploy.yaml \ --matrix java:8 \ - --env DRY_RUN=false \ + --var DRY_RUN=false \ --env GITHUB_REF_NAME=develop \ --secret-file .env ``` diff --git a/.clinerules/workflows/ci-build-dry-run.md b/.clinerules/workflows/ci-build-dry-run.md deleted file mode 100644 index 8d0609b2..00000000 --- a/.clinerules/workflows/ci-build-dry-run.md +++ /dev/null @@ -1,44 +0,0 @@ -# CI Build Dry Run - -Simulate GCViewer CI behavior for PR, develop (snapshot), or master (release) without deploying. - -## Step 1: Confirm repository and prerequisites -Verify we are in the GCViewer repository root and that `bash` and `mvn` are available. -If prerequisites are missing, stop and report the issue. - -## Step 2: Ask which CI dry run to simulate - - Which CI dry run do you want to simulate? - ["pull request", "develop snapshot", "master release", "cancel"] - - -If user selects "cancel", stop. - -## Step 3: Run selected dry run -Use `DRY_RUN=true` and execute `cicd/gcviewer-script.sh` via Git Bash with CI-like env vars. JAVA_HOME is pinned to `E:/swdevelopment/java/openjdk-21` (Git Bash path form). - -### Option A: pull request - - bash -lc "cd /d/Users/joerg2/Daten/java/git/GCViewer && JAVA_HOME='E:/swdevelopment/java/openjdk-21' DRY_RUN=true GITHUB_EVENT_NAME=pull_request GITHUB_HEAD_REF=feature/local-test GITHUB_REF_NAME=develop CI_JDK_VERSION=openjdk21 CI_COMMIT_MESSAGE='PR dry run' ./cicd/gcviewer-script.sh" - false - - -### Option B: develop snapshot - - bash -lc "cd /d/Users/joerg2/Daten/java/git/GCViewer && JAVA_HOME='E:/swdevelopment/java/openjdk-21' DRY_RUN=true GITHUB_EVENT_NAME=push GITHUB_REF_NAME=develop CI_JDK_VERSION=openjdk8 CI_COMMIT_MESSAGE='develop dry run' ./cicd/gcviewer-script.sh" - false - - -### Option C: master release - - bash -lc "cd /d/Users/joerg2/Daten/java/git/GCViewer && JAVA_HOME='E:/swdevelopment/java/openjdk-21' DRY_RUN=true GITHUB_EVENT_NAME=push GITHUB_REF_NAME=master CI_JDK_VERSION=openjdk8 CI_COMMIT_MESSAGE='master dry run' GITHUB_TOKEN=dummy ENCRYPTION_PASSWORD=dummy GPG_DIR=/d/Users/joerg2/Daten/java/git/GCViewer/cicd/gpg ./cicd/gcviewer-script.sh" - false - - -## Step 4: Summarize route taken -Report which branch path was exercised: -- PR → verify path -- develop → snapshot path (dry-run deploy) -- master → release path (dry-run release/push) - -Also report key output lines proving `DRY_RUN=true` behavior. \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 8e69a659..13bc7da6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,7 +21,7 @@ *.jsp text *.jspf text *.properties text -*.sh text +*.sh text eol=lf # act on Windows won't be able to execute with crlf line endings *.sql text *.svg text *.tld text diff --git a/.github/workflows/build-and-deploy.yaml b/.github/workflows/build-and-deploy.yaml index 415a22f1..effceeb7 100644 --- a/.github/workflows/build-and-deploy.yaml +++ b/.github/workflows/build-and-deploy.yaml @@ -28,7 +28,7 @@ jobs: # SNAPSHOT_BRANCH: develop # RELEASE_BRANCH: master # RELEASE_JDK: openjdk8 - # DRY_RUN: "true" # enable to skip deploy/push in this workflow + DRY_RUN: ${{ vars.DRY_RUN || 'true' }} # default: skip deploy/push in this workflow # Secrets GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -66,7 +66,7 @@ jobs: echo "CI_DEPLOY_PASSWORD=${CI_DEPLOY_PASSWORD}" echo "SCP_USERNAME=${SCP_USERNAME}" echo "SCP_PASSWORD=${SCP_PASSWORD}" - echo "DRY_RUN=${DRY_RUN:-true}" + echo "DRY_RUN=${DRY_RUN}" - name: Make build script executable run: chmod +x ./cicd/gcviewer-script.sh diff --git a/act/execute-build-and-deploy-snapshot-release-workflow.bat b/act/execute-build-and-deploy-snapshot-release-workflow.bat index 731a674f..d214b201 100644 --- a/act/execute-build-and-deploy-snapshot-release-workflow.bat +++ b/act/execute-build-and-deploy-snapshot-release-workflow.bat @@ -2,5 +2,5 @@ rem requirement for act builds to work: use the catthehacker/ubuntu:full-latest rem all necessary secrets are set in the .env file rem CAUTION: will do real deployments! pushd .. -act push -W .github/workflows/build-and-deploy.yaml --matrix java:8 --env DRY_RUN=false --env GITHUB_REF_NAME=develop --secret-file .env +act push -W .github/workflows/build-and-deploy.yaml --matrix java:8 --var DRY_RUN=false --env GITHUB_REF_NAME=develop --secret-file .env popd \ No newline at end of file From 1084123a94b8d12de1ea68f216942866eca62adb Mon Sep 17 00:00:00 2001 From: chewiebug Date: Sat, 23 May 2026 16:24:05 +0200 Subject: [PATCH 2/2] switch to github actions badge --- README.md | 2 +- cicd/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb29385a..2cc2b0fa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ GCViewer 1.36 ============= -[![Build Status](https://app.travis-ci.com/chewiebug/GCViewer.svg?branch=develop)](https://app.travis-ci.com/chewiebug/GCViewer) +[![Build Status](https://github.com/chewiebug/GCViewer/actions/workflows/build-and-deploy.yaml/badge.svg?branch=develop)](https://github.com/chewiebug/GCViewer/actions/workflows/build-and-deploy.yaml?query=branch%3Adevelop) [![codecov.io](https://codecov.io/github/chewiebug/GCViewer/coverage.svg?branch=develop)](https://codecov.io/github/chewiebug/GCViewer?branch=develop) [![Download gcviewer](https://img.shields.io/sourceforge/dm/gcviewer.svg)](https://sourceforge.net/projects/gcviewer/files) diff --git a/cicd/README.md b/cicd/README.md index 9729c2e4..cb2cef4e 100644 --- a/cicd/README.md +++ b/cicd/README.md @@ -1,6 +1,6 @@ # cicd This directory contains a settings.xml + script file that can be used to -deploy to the SonaType OSS repository from a Travis CI build. +deploy to the SonaType OSS repository from a Github actions build. The full instructions are here: https://jausoft.com/blog/2025/09/07/publishing-on-sonatypes-central-maven-repo/