From f6ee78cc262ebd69aeafd9da08a4c38af66aa231 Mon Sep 17 00:00:00 2001 From: Alex Lanz Date: Mon, 25 Aug 2025 16:21:45 +0200 Subject: [PATCH 1/5] optimize and generalize releases --- .github/workflows/main.yml | 27 ++++++++++++++----- .github/workflows/publish.yml | 50 +++++++++++++++-------------------- .github/workflows/test.yml | 25 ------------------ 3 files changed, 42 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5eebb8..864af1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,8 +1,6 @@ -name: Test +name: Main -on: - pull_request: - types: [ opened, reopened, synchronize ] +on: push concurrency: group: ${{ github.ref }} @@ -10,5 +8,22 @@ concurrency: jobs: test: - name: Tests - uses: ./.github/workflows/test.yml + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: aboutbits/github-actions-java/setup@v3 + with: + java-version: 21 + - name: Test + env: + GITHUB_USER_NAME: ${{ github.actor }} + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: >- + ./mvnw + -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml + --batch-mode + --fail-fast + -Dsurefire.failIfNoSpecifiedTests=false + test + shell: bash diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ae88c0b..e5bef81 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,49 +1,41 @@ -name: Publish package to GitHub Packages +name: Release Package + on: workflow_dispatch: inputs: version: - description: "Version name to publish (eg: x.x.x)" + description: "Version (eg: x.x.x)" type: string required: true jobs: - publish: - timeout-minutes: 15 + build-and-publish: runs-on: ubuntu-24.04 + timeout-minutes: 15 permissions: contents: read packages: write - steps: - uses: actions/checkout@v4 - + with: + token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + - uses: aboutbits/github-actions-base/git-setup@v2 - uses: aboutbits/github-actions-java/setup@v3 - - - name: Set Version - run: sed -i 's|BUILD-SNAPSHOT|${{ github.event.inputs.version }}|g' pom.xml - + - name: Set version of pom.xml file + run: yq -i '.project.version = "${{ github.event.inputs.version }}"' -I4 pom.xml + shell: bash + - uses: aboutbits/github-actions-base/git-commit-and-push-all@v2 + with: + message: '${{ github.event.inputs.version }}' + - uses: aboutbits/github-actions-base/git-create-or-update-tag@v2 + with: + tag-name: 'v${{ github.event.inputs.version }}' - name: Publish package - run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy env: GITHUB_USER_NAME: ${{ github.actor }} GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - release: - timeout-minutes: 5 - runs-on: ubuntu-24.04 - needs: publish - steps: - - uses: actions/checkout@v4 - - - name: Create GitHub release - uses: actions/github-script@v7 + run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy + shell: bash + - uses: aboutbits/github-actions-base/github-create-release@v2 with: - script: | - github.rest.repos.createRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: '${{ github.event.inputs.version }}', - name: 'Release ${{ github.event.inputs.version }}', - prerelease: '${{ github.event.inputs.version }}'.includes('RC') - }) + tag-name: 'v${{ github.event.inputs.version }}' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 3284ef0..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Tests - -on: - workflow_call: - -jobs: - test: - name: Maven-Java - runs-on: ubuntu-24.04 - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - uses: aboutbits/github-actions-java/setup@v3 - with: - java-version: 21 - - run: >- - ./mvnw - -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml - --batch-mode - --fail-fast - -Dsurefire.failIfNoSpecifiedTests=false - test - env: - GITHUB_USER_NAME: ${{ github.actor }} - GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f4cda71125e29858c5b01ffa895eee9fa1781795 Mon Sep 17 00:00:00 2001 From: Alex Lanz Date: Tue, 26 Aug 2025 09:44:10 +0200 Subject: [PATCH 2/5] upgrade to checkout v5 --- .github/workflows/main.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 864af1a..a650e20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: aboutbits/github-actions-java/setup@v3 with: java-version: 21 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e5bef81..3a7f6df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - uses: aboutbits/github-actions-base/git-setup@v2 From 1498b2f08de4c63c607efd03f1e51f3296047a0c Mon Sep 17 00:00:00 2001 From: Alex Lanz Date: Fri, 29 Aug 2025 13:39:56 +0200 Subject: [PATCH 3/5] extract version step to dedicated action --- .github/workflows/main.yml | 2 +- .github/workflows/publish.yml | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a650e20..96ef44f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@v5 - - uses: aboutbits/github-actions-java/setup@v3 + - uses: aboutbits/github-actions-java/setup-with-maven@v4 with: java-version: 21 - name: Test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3a7f6df..35886ea 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,10 +20,12 @@ jobs: with: token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - uses: aboutbits/github-actions-base/git-setup@v2 - - uses: aboutbits/github-actions-java/setup@v3 - - name: Set version of pom.xml file - run: yq -i '.project.version = "${{ github.event.inputs.version }}"' -I4 pom.xml - shell: bash + - uses: aboutbits/github-actions-java/setup-with-maven@v4 + with: + java-version: 21 + - uses: aboutbits/github-actions-java/set-version-with-maven@v4 + with: + version: "${{ github.event.inputs.version }}" - uses: aboutbits/github-actions-base/git-commit-and-push-all@v2 with: message: '${{ github.event.inputs.version }}' From 22b9b7509652045d3213d55bebf7018196c1fc65 Mon Sep 17 00:00:00 2001 From: Alex Lanz Date: Fri, 29 Aug 2025 15:02:48 +0200 Subject: [PATCH 4/5] add tagging as last step --- .github/workflows/publish.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 35886ea..14a0b9b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,12 @@ jobs: - uses: aboutbits/github-actions-java/setup-with-maven@v4 with: java-version: 21 + - name: Publish package + env: + GITHUB_USER_NAME: ${{ github.actor }} + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy + shell: bash - uses: aboutbits/github-actions-java/set-version-with-maven@v4 with: version: "${{ github.event.inputs.version }}" @@ -32,12 +38,6 @@ jobs: - uses: aboutbits/github-actions-base/git-create-or-update-tag@v2 with: tag-name: 'v${{ github.event.inputs.version }}' - - name: Publish package - env: - GITHUB_USER_NAME: ${{ github.actor }} - GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy - shell: bash - uses: aboutbits/github-actions-base/github-create-release@v2 with: tag-name: 'v${{ github.event.inputs.version }}' From a2d4d7899fbab2b06cc17eba5022923ec25b1290 Mon Sep 17 00:00:00 2001 From: Alex Lanz Date: Fri, 29 Aug 2025 15:56:17 +0200 Subject: [PATCH 5/5] fix wrong ordering --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 14a0b9b..9ead6d7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,15 +23,15 @@ jobs: - uses: aboutbits/github-actions-java/setup-with-maven@v4 with: java-version: 21 + - uses: aboutbits/github-actions-java/set-version-with-maven@v4 + with: + version: "${{ github.event.inputs.version }}" - name: Publish package env: GITHUB_USER_NAME: ${{ github.actor }} GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy shell: bash - - uses: aboutbits/github-actions-java/set-version-with-maven@v4 - with: - version: "${{ github.event.inputs.version }}" - uses: aboutbits/github-actions-base/git-commit-and-push-all@v2 with: message: '${{ github.event.inputs.version }}'