Skip to content

Commit f6ee78c

Browse files
committed
optimize and generalize releases
1 parent 14e3b53 commit f6ee78c

3 files changed

Lines changed: 42 additions & 60 deletions

File tree

.github/workflows/main.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
name: Test
1+
name: Main
22

3-
on:
4-
pull_request:
5-
types: [ opened, reopened, synchronize ]
3+
on: push
64

75
concurrency:
86
group: ${{ github.ref }}
97
cancel-in-progress: true
108

119
jobs:
1210
test:
13-
name: Tests
14-
uses: ./.github/workflows/test.yml
11+
runs-on: ubuntu-24.04
12+
timeout-minutes: 10
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: aboutbits/github-actions-java/setup@v3
16+
with:
17+
java-version: 21
18+
- name: Test
19+
env:
20+
GITHUB_USER_NAME: ${{ github.actor }}
21+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: >-
23+
./mvnw
24+
-s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml
25+
--batch-mode
26+
--fail-fast
27+
-Dsurefire.failIfNoSpecifiedTests=false
28+
test
29+
shell: bash

.github/workflows/publish.yml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,41 @@
1-
name: Publish package to GitHub Packages
1+
name: Release Package
2+
23
on:
34
workflow_dispatch:
45
inputs:
56
version:
6-
description: "Version name to publish (eg: x.x.x)"
7+
description: "Version (eg: x.x.x)"
78
type: string
89
required: true
910

1011
jobs:
11-
publish:
12-
timeout-minutes: 15
12+
build-and-publish:
1313
runs-on: ubuntu-24.04
14+
timeout-minutes: 15
1415
permissions:
1516
contents: read
1617
packages: write
17-
1818
steps:
1919
- uses: actions/checkout@v4
20-
20+
with:
21+
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
22+
- uses: aboutbits/github-actions-base/git-setup@v2
2123
- uses: aboutbits/github-actions-java/setup@v3
22-
23-
- name: Set Version
24-
run: sed -i 's|<version>BUILD-SNAPSHOT</version>|<version>${{ github.event.inputs.version }}</version>|g' pom.xml
25-
24+
- name: Set version of pom.xml file
25+
run: yq -i '.project.version = "${{ github.event.inputs.version }}"' -I4 pom.xml
26+
shell: bash
27+
- uses: aboutbits/github-actions-base/git-commit-and-push-all@v2
28+
with:
29+
message: '${{ github.event.inputs.version }}'
30+
- uses: aboutbits/github-actions-base/git-create-or-update-tag@v2
31+
with:
32+
tag-name: 'v${{ github.event.inputs.version }}'
2633
- name: Publish package
27-
run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy
2834
env:
2935
GITHUB_USER_NAME: ${{ github.actor }}
3036
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
32-
release:
33-
timeout-minutes: 5
34-
runs-on: ubuntu-24.04
35-
needs: publish
36-
steps:
37-
- uses: actions/checkout@v4
38-
39-
- name: Create GitHub release
40-
uses: actions/github-script@v7
37+
run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml --batch-mode deploy
38+
shell: bash
39+
- uses: aboutbits/github-actions-base/github-create-release@v2
4140
with:
42-
script: |
43-
github.rest.repos.createRelease({
44-
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
tag_name: '${{ github.event.inputs.version }}',
47-
name: 'Release ${{ github.event.inputs.version }}',
48-
prerelease: '${{ github.event.inputs.version }}'.includes('RC')
49-
})
41+
tag-name: 'v${{ github.event.inputs.version }}'

.github/workflows/test.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)