-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy in GitHub Actions with semantic versioning (#80)
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Publish package to Maven Central | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [closed] | ||
|
||
jobs: | ||
publish: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Step 1 - Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Step 2 - Import GPG key | ||
run: | | ||
echo "${{ secrets.GPG_PUBLIC_KEY }}" | gpg --import | ||
echo "${{ secrets.GPG_SECRET_KEY }}" | gpg --import --no-tty --batch --yes | ||
- name: Step 3 - Set up Maven Central Repository | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "8" | ||
distribution: "adopt" | ||
server-id: ossrh | ||
server-username: ${{ secrets.OSSRH_USERNAME }} | ||
server-password: ${{ secrets.OSSRH_TOKEN }} | ||
|
||
- name: Step 4 - Install GitVersion | ||
uses: gittools/actions/gitversion/setup@v0 | ||
with: | ||
versionSpec: '5.x' | ||
- name: Step 5 - Determine Version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/execute@v0 | ||
with: | ||
useConfigFile: true | ||
|
||
- name: Step 6 - Create Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TITLE: ${{ github.event.pull_request.title }} | ||
BODY: ${{ github.event.pull_request.body }} | ||
VERSION: "v${{ steps.gitversion.outputs.semVer }}" | ||
with: | ||
tag_name: $VERSION | ||
release_name: $VERSION $TITLE | ||
body: $BODY | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Step 7 - Publish package | ||
run: | | ||
mvn -P release -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \ | ||
-Drevision=${{ steps.gitversion.outputs.semVer }} deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mode: Mainline | ||
increment: Inherit | ||
branches: {} | ||
ignore: | ||
sha: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters