Maven Publish #88
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
name: Maven Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
libraryVersion: | |
description: 'Library Version' | |
required: true | |
default: '' | |
packageVersion: | |
description: 'Package Version' | |
required: true | |
default: '' | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Update Version | |
run: | | |
sed -i '/VERSION=/!b;cVERSION=\"v${{ github.event.inputs.libraryVersion }}";' ./download-libs.sh | |
- name: Commit, Tag and Push | |
run: | | |
git add ./download-libs.sh | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "updated version" | exit 0 | |
git tag ${{ github.event.inputs.packageVersion }} | |
git push & git push --tags | |
publish: | |
needs: update-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: git pull origin master --ff-only | |
- name: Assemble Resources | |
run: ./download-libs.sh | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Update Version in pom.xml | |
run: mvn -B versions:set -DnewVersion=${{ github.event.inputs.packageVersion }} -DgenerateBackupPoms=false | |
- name: Publish Maven package | |
uses: samuelmeuli/action-maven-publish@v1 | |
with: | |
maven_args: "-e -X -Drevision=${{ github.event.inputs.packageVersion }}" | |
server_id: ossrh | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
nexus_username: ${{ secrets.MAVEN_USERNAME }} | |
nexus_password: ${{ secrets.MAVEN_PASSWORD }} |