@@ -3,49 +3,59 @@ name: Release project in specified directory
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
- project-dir :
6
+ project_dir :
7
7
type : string
8
8
required : true
9
- version-branch :
9
+ version_branch :
10
10
type : string
11
11
required : true
12
12
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
+
13
17
jobs :
14
18
publish :
15
19
runs-on : ubuntu-latest
16
20
steps :
17
- - name : Checkout "${{inputs.version-branch }}" branch
21
+ - name : Checkout "${{inputs.version_branch }}" branch
18
22
uses : actions/checkout@v3
19
23
with :
20
- ref : " ${{inputs.version-branch }}"
24
+ ref : " ${{inputs.version_branch }}"
21
25
22
26
- name : Set up Java and Maven
23
27
uses : actions/setup-java@v3
24
28
with :
25
29
java-version : 11
26
30
distribution : temurin
27
31
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
34
32
35
33
- name : Change version to release version
36
34
# 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
38
37
env :
39
38
RELEASE_VERSION : ${{ github.event.release.tag_name }}
40
39
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
+
41
50
# This is separate job because there were issues with git after release step, was not able to commit changes.
42
51
update-working-version :
43
52
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
45
55
steps :
46
56
- uses : actions/checkout@v3
47
57
with :
48
- ref : " ${{inputs.version-branch }}"
58
+ ref : " ${{inputs.version_branch }}"
49
59
50
60
- name : Set up Java and Maven
51
61
uses : actions/setup-java@v3
@@ -60,12 +70,12 @@ jobs:
60
70
mvn ${MAVEN_ARGS} -q build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
61
71
git config --local user.email "[email protected] "
62
72
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
64
74
env :
65
75
RELEASE_VERSION : ${{ github.event.release.tag_name }}
66
76
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