Skip to content

Commit f5e61db

Browse files
authored
Merge pull request #394 from ChinthakaJ98/maven-release-main
Add Github workflow for Maven release
2 parents 8ac8361 + 85b5139 commit f5e61db

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/publish-release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
Ubuntu:
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/[email protected]
14+
with:
15+
token: ${{ secrets.WSO2_INTEGRATION_BOT_TOKEN }}
16+
fetch-depth: 0
17+
- name: Set up JDK 11
18+
uses: joschi/setup-jdk@v2
19+
with:
20+
distribution: 'adopt'
21+
java-version: 11
22+
- name: Extract project version
23+
run: |
24+
VERSION=$(grep -oPm1 "(?<=<version>)[^<]+" pom.xml | sed 's/-SNAPSHOT$//')
25+
VERSION_TAG="v$VERSION"
26+
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
27+
- name: Configure Maven settings file
28+
run: |
29+
mkdir -p ~/.m2
30+
echo "<settings>
31+
<servers>
32+
<server>
33+
<id>nexus-releases</id>
34+
<username>${{ secrets.NEXUS_USERNAME }}</username>
35+
<password>${{ secrets.NEXUS_PASSWORD }}</password>
36+
</server>
37+
</servers>
38+
</settings>" > ~/.m2/settings.xml
39+
- name: Configure git credentials
40+
run: |
41+
git config --global user.name ${{ secrets.WSO2_INTEGRATION_BOT_USERNAME }}
42+
git config --global user.email ${{ secrets.WSO2_INTEGRATION_BOT_EMAIL }}
43+
- name: Build artifacts
44+
run: |
45+
mvn clean install
46+
- name: Deploy artifacts with Maven
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.WSO2_INTEGRATION_BOT_TOKEN }}
49+
run: |
50+
mvn --batch-mode release:prepare release:perform -Dtag=${{ env.VERSION_TAG }}
51+
- name: Create Github Release with Assets
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.WSO2_INTEGRATION_BOT_TOKEN }}
54+
run: |
55+
find target/ -type f -name '*-SNAPSHOT.zip' -exec rm -f {} \;
56+
gh release create "${{ env.VERSION_TAG }}" \
57+
--repo="$GITHUB_REPOSITORY" \
58+
--title="${{ env.VERSION_TAG }}" \
59+
--generate-notes \
60+
target/*.zip

0 commit comments

Comments
 (0)