1
- name : Maven Build and Deploy
1
+ name : Maven Build and Release for Mule-Plugin
2
2
3
3
on :
4
4
push :
5
5
branches :
6
6
- ' main'
7
- - ' feature/**'
7
+ - ' chore/**'
8
+ - ' feat/**'
9
+ - ' fix/**'
8
10
pull_request :
9
11
branches :
10
12
- ' main'
11
13
12
14
jobs :
13
- Build :
14
- runs-on : ubuntu-latest
15
-
16
- outputs :
17
- version : ${{ steps.set-version.outputs.version }}
18
- token : ${{ steps.get-token.outputs.token }}
19
-
20
- steps :
21
- - uses : actions/checkout@v3
22
- with :
23
- submodules : ' recursive'
24
-
25
- - name : Set up JDK 1.8 for build and unit test
26
- uses : actions/setup-java@v3
27
- with :
28
- distribution : adopt-hotspot
29
- java-version : 8
30
- cache : maven
31
- server-id : mulesoft-ee-releases
32
- server-username : MULE_EE_USERNAME
33
- server-password : MULE_EE_PASSWORD
34
-
35
- - name : Set Version
36
- id : set-version
37
- run : echo version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT
38
-
39
- - name : Print Version
40
- run : echo "Version ${{ steps.set-version.outputs.version }}"
41
-
42
- - name : Compile
43
- run : ./mvnw compile
44
- env :
45
- MULE_EE_USERNAME : ${{ secrets.MULE_EE_USERNAME }}
46
- MULE_EE_PASSWORD : ${{ secrets.MULE_EE_PASSWORD }}
47
-
48
- - name : Verify
49
- run : ./mvnw --batch-mode verify
50
- env :
51
- MULE_EE_USERNAME : ${{ secrets.MULE_EE_USERNAME }}
52
- MULE_EE_PASSWORD : ${{ secrets.MULE_EE_PASSWORD }}
53
-
54
- - name : Publish Unit Test Results
55
- uses : EnricoMi/publish-unit-test-result-action@v2
56
- if : always()
57
- with :
58
- github_token : ${{ secrets.GITHUB_TOKEN }}
59
- junit_files : ./**/surefire-reports/*.xml
60
-
61
- - name : Set up JDK 1.8 for maven central publish
62
- uses : actions/setup-java@v3
63
- with :
64
- distribution : adopt-hotspot
65
- java-version : 8
66
- cache : maven
67
- server-id : ossrh
68
- server-username : OSSRH_USERNAME
69
- server-password : OSSRH_PASSWORD
70
- gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
71
- gpg-passphrase : MAVEN_GPG_PASSPHRASE
72
-
73
- - name : Publish to Maven Central
74
- id : publish-to-maven-central
75
- if : ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
76
- run : ./mvnw clean deploy -DskipTests -Drelease=true
77
- env :
78
- OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
79
- OSSRH_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
80
- MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
81
-
82
- - name : Set up JDK for Exchange Publish
83
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
84
- uses : actions/setup-java@v3
85
- with :
86
- distribution : temurin
87
- java-version : 8
88
- cache : maven
89
- server-id : anypoint-exchange
90
- server-username : ANYPOINT_USERNAME
91
- server-password : ANYPOINT_PASSWORD
92
-
93
- - name : Get Exchange Token
94
- id : get-token
95
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
96
- run : |
97
- echo token=$(curl --location --request POST 'https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=${{secrets.ANYPOINT_EXCHANGE_CLIENT_ID}}' --data-urlencode 'client_secret=${{secrets.ANYPOINT_EXCHANGE_CLIENT_SECRET}}' --data-urlencode 'grant_type=client_credentials' | jq -r .access_token) >> $GITHUB_OUTPUT
98
-
99
- - name : Publish Exchange Artifact
100
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
101
- env :
102
- ANYPOINT_USERNAME : " ~~~Token~~~"
103
- ANYPOINT_PASSWORD : ${{ steps.get-token.outputs.token }}
104
- run : ./deploy-to-exchange.sh ${{ secrets.ANYPOINT_ORG_ID }}
105
-
106
- - name : Tag Release
107
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
108
- env :
109
- GIT_USER : ${{ secrets.GIT_USER }}
110
- GIT_PASSWORD : ${{ secrets.GIT_TOKEN }}
111
- run : |
112
- git config --global user.email "${{ github.actor }}@users.noreply.github.com"
113
- git config --global user.name "${{ github.actor }}"
114
- git remote set-url origin "https://${{github.actor}}:${{ github.token }}@github.com/${{ github.repository }}.git"
115
- git tag -a "v${{ steps.set-version.outputs.version }}" "${{ github.sha }}" -m "Version ${{ steps.set-version.outputs.version }}"
116
- git push --follow-tags
117
-
118
- - name : Increment Version
119
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
120
- run : |
121
- ./mvnw clean build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT -DprocessAllModules versions:commit
122
-
123
- - name : Set New Version Variable
124
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
125
- id : set-new-version
126
- run : echo version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT
127
-
128
- - name : Create Pull Request
129
- if : ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
130
- uses : peter-evans/create-pull-request@v4
131
- with :
132
- branch : " feature/v${{ steps.set-new-version.outputs.version }}"
133
- commit-message : " [create-pull-request] Auto increment to v${{ steps.set-new-version.outputs.version }}"
134
- title : " Auto increment to v${{ steps.set-new-version.outputs.version }}"
135
- delete-branch : true
136
- assignees : ${{ github.actor }}
137
- reviewers : adesjardin,adammead, manikmagar, kkingavio
138
-
139
- # - name: Add Release Note and Create Github Release
140
- # if: ${{ !contains(steps.set-version.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
141
- # uses: release-drafter/release-drafter@v5
142
- # with:
143
- # version: ${{ steps.set-version.outputs.version }}
144
- # tag: v${{ steps.set-version.outputs.version }}
145
- # publish: true
146
- # env:
147
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15
+ Build-Maven :
16
+ uses : avioconsulting/shared-workflows/.github/workflows/maven-build.yml@main
17
+ secrets : inherit
18
+ with :
19
+ include-mule-ee-repo : true
20
+ # java-distribution: adopt-hotspot
21
+ # java-version: 8
22
+ # include-test-results: true
23
+ # maven-args: -X
24
+
25
+ Release-Maven :
26
+ needs : Build-Maven
27
+ uses : avioconsulting/shared-workflows/.github/workflows/maven-release.yml@main
28
+ secrets : inherit
29
+ with :
30
+ app-version : ${{ needs.Build-Maven.outputs.app-version }}
31
+ publish-maven-central : true
32
+ # java-distribution: adopt-hotspot
33
+ # java-version: 8
34
+ # maven-args: -X
35
+ # main-branch: main
36
+
37
+ Post-Release-Maven :
38
+ needs : [Build-Maven, Release-Maven]
39
+ uses : avioconsulting/shared-workflows/.github/workflows/maven-post-release.yml@main
40
+ secrets : inherit
41
+ with :
42
+ app-version : ${{ needs.Build-Maven.outputs.app-version }}
43
+ # java-distribution: adopt-hotspot
44
+ # java-version: 8
45
+ # maven-args: -X
46
+ # main-branch: main
47
+ # pr-reviewers: adesjardin, manikmagar, kkingavio
0 commit comments