15
15
description : ' Specified version to release'
16
16
required : false
17
17
default : ' '
18
-
18
+
19
19
jobs :
20
20
release :
21
21
@@ -24,76 +24,76 @@ jobs:
24
24
runs-on : ubuntu-latest
25
25
26
26
steps :
27
-
28
- - name : Checkout project
29
- uses : actions/checkout@v3
30
- with :
31
- persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
32
- - name : Set up JDK 11
33
- uses : actions/setup-java@v3.4.1
34
- with :
35
- java-version : 11
36
- distribution : temurin
37
- cache : maven
38
- - name : Import GPG key
39
- id : import_gpg
40
- uses : crazy-max/ghaction-import-gpg@v5.1.0
41
- with :
42
- gpg-private-key : ${{ secrets.GPG_SIGNING_KEY }}
43
- passphrase : ${{ secrets.GPG_PASSPHRASE }}
44
- - name : GPG user IDs
45
- run : |
46
- echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
47
- echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
48
- echo "name: ${{ steps.import_gpg.outputs.name }}"
49
- echo "email: ${{ steps.import_gpg.outputs.email }}"
50
- - name : Get maven version
51
- id : version
52
- run : |
53
- export version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
54
- export version=$(echo "${version%%-*}")
55
- echo "::set-output name=version::$(echo $version)"
56
- - name : Print current version
57
- run : echo "Current version = ${{ steps.version.outputs.version }}"
58
- - name : ' Compute next versions'
59
- id : next
60
- uses : " WyriHaximus/github-action-next-semvers@v1"
61
- with :
62
- version : ${{ steps.version.outputs.version }}
63
- - name : Choose next version
64
- id : choose
65
- run : |
66
- export version=$(echo ${{ github.event.inputs.version }})
67
- if [[ $version != '' ]] ; then export next=$version; elif [[ ${{ github.event.inputs.type }} == "major" ]] ; then export next=${{ steps.next.outputs.major }}; elif [[ ${{ github.event.inputs.type }} == "minor" ]] ; then export next=${{ steps.next.outputs.minor }}; else export next=${{ steps.version.outputs.version }}; fi
68
- echo "::set-output name=next::$(echo $next)"
69
- export purenext=$(echo "${next%%-*}")
70
- echo "::set-output name=purenext::$(echo $purenext)"
71
- - name : ' Get next snapshot version'
72
- id : snapshot
73
- uses : " WyriHaximus/github-action-next-semvers@v1"
74
- with :
75
- version : ${{ steps.choose.outputs.purenext }}
76
- - name : Set release and snapshot versions
77
- id : versions
78
- run : |
79
- echo "::set-output name=snapshot::$(echo ${{ steps.snapshot.outputs.patch }}-SNAPSHOT)"
80
- echo "::set-output name=release::$(echo ${{ steps.choose.outputs.next }})"
81
- - name : Log versions
82
- run : echo "Releasing version ${{ steps.versions.outputs.release }}, new dev version will be ${{ steps.versions.outputs.snapshot }}"
83
- - name : Configure git user
84
- run : |
85
- git config user.email "actions@github.com"
86
- git config user.name "GitHub Actions"
87
- - name : Configure maven settings
88
- uses : s4u/maven-settings-action@v2.6.0
89
- with :
90
- servers : ' [{ "id": "ossrh", "username": "${{ secrets.OSSRH_USERNAME }}", "password": "${{ secrets.OSSRH_PASSWORD }}" }]'
91
- - name : Release
92
- run : mvn -B -ntp release:prepare release:clean -DreleaseVersion=${{ steps.versions.outputs.release }} -DdevelopmentVersion=${{ steps.versions.outputs.snapshot }}
93
- - name : Push changes
94
- uses : ad-m/github-push-action@master
95
- with :
96
- gh_token : ${{ secrets.GITHUB_TOKEN }}
97
- branch : ${{ github.ref }}
98
- tags : true
99
- force : true
27
+
28
+ - name : Checkout project
29
+ uses : actions/checkout@v3
30
+ with :
31
+ persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
32
+ - name : Set up JDK 11
33
+ uses : actions/setup-java@v3.4.1
34
+ with :
35
+ java-version : 11
36
+ distribution : temurin
37
+ cache : maven
38
+ - name : Import GPG key
39
+ id : import_gpg
40
+ uses : crazy-max/ghaction-import-gpg@v5.1.0
41
+ with :
42
+ gpg-private-key : ${{ secrets.GPG_SIGNING_KEY }}
43
+ passphrase : ${{ secrets.GPG_PASSPHRASE }}
44
+ - name : GPG user IDs
45
+ run : |
46
+ echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
47
+ echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
48
+ echo "name: ${{ steps.import_gpg.outputs.name }}"
49
+ echo "email: ${{ steps.import_gpg.outputs.email }}"
50
+ - name : Get maven version
51
+ id : version
52
+ run : |
53
+ export version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
54
+ export version=$(echo "${version%%-*}")
55
+ echo "::set-output name=version::$(echo $version)"
56
+ - name : Print current version
57
+ run : echo "Current version = ${{ steps.version.outputs.version }}"
58
+ - name : ' Compute next versions'
59
+ id : next
60
+ uses : " WyriHaximus/github-action-next-semvers@v1"
61
+ with :
62
+ version : ${{ steps.version.outputs.version }}
63
+ - name : Choose next version
64
+ id : choose
65
+ run : |
66
+ export version=$(echo ${{ github.event.inputs.version }})
67
+ if [[ $version != '' ]] ; then export next=$version; elif [[ ${{ github.event.inputs.type }} == "major" ]] ; then export next=${{ steps.next.outputs.major }}; elif [[ ${{ github.event.inputs.type }} == "minor" ]] ; then export next=${{ steps.next.outputs.minor }}; else export next=${{ steps.version.outputs.version }}; fi
68
+ echo "::set-output name=next::$(echo $next)"
69
+ export purenext=$(echo "${next%%-*}")
70
+ echo "::set-output name=purenext::$(echo $purenext)"
71
+ - name : ' Get next snapshot version'
72
+ id : snapshot
73
+ uses : " WyriHaximus/github-action-next-semvers@v1"
74
+ with :
75
+ version : ${{ steps.choose.outputs.purenext }}
76
+ - name : Set release and snapshot versions
77
+ id : versions
78
+ run : |
79
+ echo "::set-output name=snapshot::$(echo ${{ steps.snapshot.outputs.patch }}-SNAPSHOT)"
80
+ echo "::set-output name=release::$(echo ${{ steps.choose.outputs.next }})"
81
+ - name : Log versions
82
+ run : echo "Releasing version ${{ steps.versions.outputs.release }}, new dev version will be ${{ steps.versions.outputs.snapshot }}"
83
+ - name : Configure git user
84
+ run : |
85
+ git config user.email "actions@github.com"
86
+ git config user.name "GitHub Actions"
87
+ - name : Configure maven settings
88
+ uses : s4u/maven-settings-action@v2.6.0
89
+ with :
90
+ servers : ' [{ "id": "ossrh", "username": "${{ secrets.OSSRH_USERNAME }}", "password": "${{ secrets.OSSRH_PASSWORD }}" }]'
91
+ - name : Release
92
+ run : mvn -B -ntp release:prepare release:clean -DreleaseVersion=${{ steps.versions.outputs.release }} -DdevelopmentVersion=${{ steps.versions.outputs.snapshot }}
93
+ - name : Push changes
94
+ uses : ad-m/github-push-action@master
95
+ with :
96
+ gh_token : ${{ secrets.GITHUB_TOKEN }}
97
+ branch : ${{ github.ref }}
98
+ tags : true
99
+ force : true
0 commit comments