From 5125a3b10edaae7bedcc909e3675ded908ddbf1f Mon Sep 17 00:00:00 2001 From: Xitee <59659167+Xitee1@users.noreply.github.com> Date: Sat, 18 Apr 2026 14:22:07 +0200 Subject: [PATCH] Add CI workflows for build and release - build.yml: builds on push/PR to master, uploads JAR artifact - release.yml: on release-* tags, verifies tag matches pom.xml version, builds, attaches JAR and release notes to GitHub release Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4314c0a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + cache: maven + + - name: Build with Maven + run: mvn -B --no-transfer-progress package + + - name: Upload JAR + uses: actions/upload-artifact@v4 + with: + name: PowerBoard-jar + path: target/*.jar + if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..119abac --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + tags: ['release-*'] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + cache: maven + + - name: Verify tag matches pom.xml version + run: | + POM_VERSION=$(mvn -B -q help:evaluate -Dexpression=project.version -DforceStdout) + TAG_VERSION="${GITHUB_REF_NAME#release-}" + echo "pom.xml version: $POM_VERSION" + echo "Tag version: $TAG_VERSION" + if [ "$POM_VERSION" != "$TAG_VERSION" ]; then + echo "::error::Tag '$GITHUB_REF_NAME' does not match pom.xml version '$POM_VERSION'" + exit 1 + fi + + - name: Build with Maven + run: mvn -B --no-transfer-progress package + + - name: Publish Release + uses: softprops/action-gh-release@v2 + with: + files: target/*.jar + generate_release_notes: true + fail_on_unmatched_files: true