diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5eebb8..96ef44f 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@v5 + - uses: aboutbits/github-actions-java/setup-with-maven@v4 + 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 de5c28a..9ead6d7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,49 +1,43 @@ -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 - - - uses: aboutbits/github-actions-java/setup@v3 - - - name: Set Version - run: sed -i 's|BUILD-SNAPSHOT|${{ github.event.inputs.version }}|g' pom.xml - + - uses: actions/checkout@v5 + with: + token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + - uses: aboutbits/github-actions-base/git-setup@v2 + - 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 - 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/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 }}' + - 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: 'v${{ github.event.inputs.version }}', - name: 'v${{ 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 }}