@@ -3,49 +3,59 @@ name: Release project in specified directory
33on :
44 workflow_call :
55 inputs :
6- project-dir :
6+ project_dir :
77 type : string
88 required : true
9- version-branch :
9+ version_branch :
1010 type : string
1111 required : true
1212
13+ env :
14+ # set the target pom to use the input directory as root
15+ MAVEN_ARGS : -V -ntp -e -f ${{ inputs.project_dir }}/pom.xml
16+
1317jobs :
1418 publish :
1519 runs-on : ubuntu-latest
1620 steps :
17- - name : Checkout "${{inputs.version-branch }}" branch
21+ - name : Checkout "${{inputs.version_branch }}" branch
1822 uses : actions/checkout@v3
1923 with :
20- ref : " ${{inputs.version-branch }}"
24+ ref : " ${{inputs.version_branch }}"
2125
2226 - name : Set up Java and Maven
2327 uses : actions/setup-java@v3
2428 with :
2529 java-version : 11
2630 distribution : temurin
2731 cache : ' maven'
28-
29- - name : Move to specified directory
30- working-directory : ${{inputs.project-dir}}
31- run : |
32- echo "Releasing from ${{inputs.project-dir}}"
33- shell : bash
3432
3533 - name : Change version to release version
3634 # Assume that RELEASE_VERSION will have form like: "v1.0.1". So we cut the "v"
37- run : mvn ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit
35+ run : |
36+ mvn ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit
3837 env :
3938 RELEASE_VERSION : ${{ github.event.release.tag_name }}
4039
40+ - name : Release Maven package
41+ uses : samuelmeuli/action-maven-publish@v1
42+ with :
43+ maven_profiles : " release"
44+ maven_args : ${{ env.MAVEN_ARGS }}
45+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
46+ gpg_passphrase : ${{ secrets.GPG_PASSPHRASE }}
47+ nexus_username : ${{ secrets.OSSRH_USERNAME }}
48+ nexus_password : ${{ secrets.OSSRH_TOKEN }}
49+
4150 # This is separate job because there were issues with git after release step, was not able to commit changes.
4251 update-working-version :
4352 runs-on : ubuntu-latest
44- if : " success() && !contains(github.event.release.tag_name, 'RC')" # not sure we should keep this the RC part
53+ needs : publish
54+ if : " !contains(github.event.release.tag_name, 'RC')" # not sure we should keep this the RC part
4555 steps :
4656 - uses : actions/checkout@v3
4757 with :
48- ref : " ${{inputs.version-branch }}"
58+ ref : " ${{inputs.version_branch }}"
4959
5060 - name : Set up Java and Maven
5161 uses : actions/setup-java@v3
@@ -60,12 +70,12 @@ jobs:
6070 mvn ${MAVEN_ARGS} -q build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
6171 git config --local user.email "action@github.com"
6272 git config --local user.name "GitHub Action"
63- # git commit -m "Set new SNAPSHOT version into pom files." -a
73+ git commit -m "Set new SNAPSHOT version into pom files." -a
6474 env :
6575 RELEASE_VERSION : ${{ github.event.release.tag_name }}
6676
67- # - name: Push changes to branch
68- # uses: ad-m/github-push-action@master
69- # with:
70- # branch: "${{inputs.version-branch }}"
71- # github_token: ${{ secrets.GITHUB_TOKEN }}
77+ - name : Push changes to branch
78+ uses : ad-m/github-push-action@master
79+ with :
80+ branch : " ${{inputs.version_branch }}"
81+ github_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments