1+ ---
2+ name : Release
3+
4+ on :
5+ workflow_dispatch :
6+ inputs :
7+ version :
8+ description : ' Release version'
9+ required : true
10+
11+ env :
12+ JAVA_VERSION : ' 11'
13+ JAVA_DISTRO : ' zulu'
14+ USER_EMAIL : ' 41898282+github-actions[bot]@users.noreply.github.com'
15+ USER_NAME : ' GitHub Action'
16+
17+ jobs :
18+ release :
19+ name : Release
20+ runs-on : ubuntu-latest
21+
22+ steps :
23+ - name : Checkout sources
24+ uses : actions/checkout@v3
25+ with :
26+ fetch-depth : 0
27+
28+ - name : Setup Java
29+ uses : actions/setup-java@v3
30+ with :
31+ java-version : ${{ env.JAVA_VERSION }}
32+ distribution : ${{ env.JAVA_DISTRO }}
33+ server-id : central
34+ server-username : MAVEN_USERNAME
35+ server-password : MAVEN_CENTRAL_TOKEN
36+ gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
37+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
38+
39+ - name : Cache Maven
40+ uses : actions/cache@v2
41+ with :
42+ path : ~/.m2/repository
43+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
44+ restore-keys : ${{ runner.os }}-m2
45+
46+ - name : Version
47+ run : |
48+ VERSION=${{ github.event.inputs.version }}
49+ echo "Updating POMs to version $VERSION"
50+ ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION
51+ git config --global user.email "${{ env.USER_EMAIL }}"
52+ git config --global user.name "${{ env.USER_NAME }}"
53+ git commit -a -m "Releasing version $VERSION"
54+ git push origin main
55+
56+ - name : Release
57+ env :
58+ MAVEN_USERNAME : ${{ secrets.SONATYPE_USERNAME }}
59+ MAVEN_CENTRAL_TOKEN : ${{ secrets.SONATYPE_PASSWORD }}
60+ MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
61+ run : |
62+ GPG_TTY=$(tty)
63+ export GPG_TTY
64+ ./mvnw --no-transfer-progress -B --file pom.xml \
65+ -Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \
66+ -Dmaven.site.skip=true -Drelease=true deploy
0 commit comments