11name : Release
2- run-name : Release ${{ inputs.releaseVersion }}
2+ run-name : Release ${{ github.ref_name }}
33
44on :
5- workflow_dispatch :
6- inputs :
7- releaseVersion :
8- description : ' Release version number'
9- required : true
10- developmentVersion :
11- description : ' Next development (snapshot) version number'
12- required : true
5+ push :
6+ tags :
7+ - ' v[0-9]*'
138
149jobs :
1510 release :
16- name : Create release
11+ name : Create Release
1712 runs-on : ubuntu-latest
1813 steps :
19- - name : Create access token
20- uses : actions/create-github-app-token@v3
21- id : app-token
22- with :
23- app-id : ${{ vars.RELEASE_APP_ID }}
24- private-key : ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
25- - name : Check out from SCM
26- uses : actions/checkout@v6
27- with :
28- token : ${{ steps.app-token.outputs.token }}
2914 - name : Import GPG key
3015 uses : crazy-max/ghaction-import-gpg@v7
3116 with :
3722 echo "GPG key expires on ${EXPIRY}"
3823 DELTA=$(( $(date --date "${EXPIRY}" '+%s') - $(date '+%s') ))
3924 echo "GPG key expires in ${DELTA} seconds"
40- [[ ${DELTA} -ge 0 ]]
25+ [[ ${DELTA} -ge 600 ]]
26+ - name : Check out from SCM
27+ uses : actions/checkout@v6
4128 - name : Set up JDK/Maven
4229 uses : actions/setup-java@v5
4330 with :
@@ -52,52 +39,14 @@ jobs:
5239 "username": "${{ secrets.MAVEN_CENTRAL_USER }}",
5340 "password": "${{ secrets.MAVEN_CENTRAL_PASSWORD }}"
5441 }]
55- - name : Configure git
56- run : |
57- git config --global committer.email "noreply@github.com"
58- git config --global committer.name "GitHub Actions"
59- git config --global author.email "${{ github.actor }}@users.noreply.github.com"
60- git config --global author.name "${{ github.actor }}"
61- - name : Prepare release
62- id : prepare_release
63- run : >-
64- mvn
65- --batch-mode
66- "-DpreparationGoals=clean compile"
67- "-DreleaseVersion=${{ github.event.inputs.releaseVersion }}"
68- "-DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}"
69- "-Dtag=v${{ github.event.inputs.releaseVersion }}"
70- "-Dusername=${{ github.actor }}"
71- "-Dpassword=${{ steps.app-token.outputs.token }}"
72- "-DrepoBaseUrl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
73- release:prepare
74- - name : Perform release
75- id : perform_release
42+ - name : Deploy artifacts
7643 env :
7744 AUTO_RELEASE : ${{ vars.AUTO_RELEASE }}
7845 MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
7946 run : >-
8047 mvn
8148 --batch-mode
82- "-Dgoals=deploy"
83- "-DreleaseProfiles=release,-examples"
84- "-Darguments=-DrepoBaseUrl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
85- "-Dusername=${{ github.actor }}"
86- "-Dpassword=${{ steps.app-token.outputs.token }}"
87- "-DrepoBaseUrl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
88- release:perform
89- - name : Create GitHub release
90- id : create_github_release
91- uses : softprops/action-gh-release@v2
92- with :
93- tag_name : v${{ github.event.inputs.releaseVersion }}
94- name : hamcrest-mail-${{ github.event.inputs.releaseVersion }}
95- body : |-
96- Release ${{ github.event.inputs.releaseVersion }} of hamcrest-mail
97-
98- [Change log](${{ github.server_url }}/${{ github.repository }}/blob/main/CHANGES.md)
99- files : |
100- ./target/checkout/hamcrest-mail/target/hamcrest-mail-${{ github.event.inputs.releaseVersion }}.jar
101- ./target/checkout/hamcrest-mail/target/hamcrest-mail-${{ github.event.inputs.releaseVersion }}-javadoc.jar
102- ./target/checkout/hamcrest-mail-jakarta/target/hamcrest-mail-jakarta-${{ github.event.inputs.releaseVersion }}.jar
103- ./target/checkout/hamcrest-mail-jakarta/target/hamcrest-mail-jakarta-${{ github.event.inputs.releaseVersion }}-javadoc.jar
49+ --activate-profiles=release,-examples
50+ --define=gpg.useagent=false
51+ --define=repoBaseUrl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
52+ deploy
0 commit comments