On workflow dispatch start maven release #6
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: On workflow dispatch start maven release | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseversion: | |
description: 'Release version' | |
required: true | |
default: "0.1.11" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# See https://stackoverflow.com/a/61421306/15619 | |
env: | |
RELEASE_VERSION: ${{github.event.inputs.releaseversion}} | |
steps: | |
- run: echo "Will perform a maven release with public version ${{ github.event.inputs.releaseversion }}" | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: '0' | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6.1.0 | |
with: | |
gpg_private_key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Setup git configuration | |
run: | | |
git config --global user.email "aadarchi-releaser-bot@users.noreply.github.com" | |
git config --global user.name "🤖 Aadarchi releaser bot" | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
cache: maven | |
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | |
server-username: ${{ secrets.OSS_SONATYPE_USERNAME }} | |
server-password: ${{ secrets.OSS_SONATYPE_PASSWORD }} | |
- name: Do not forget to configure Maven Settings! | |
uses: s4u/maven-settings-action@v3.0.0 | |
with: | |
override: true | |
githubServer: true | |
servers: | | |
[{ | |
"id": "ossrh", | |
"username": "${{ secrets.OSS_SONATYPE_USERNAME }}", | |
"password": "${{ secrets.OSS_SONATYPE_PASSWORD }}" | |
}] | |
properties: | | |
[ | |
{"aadarchi.github.token": "${{ secrets.TOKEN_FOR_GITHUB }}" }, | |
{"aadarchi.gitlab.token": "${{ secrets.TOKEN_FOR_GITLAB }}" }, | |
{"releaseVersion": "${{env.RELEASE_VERSION}}" }, | |
{"gpg.passphrase": "${{secrets.MAVEN_GPG_PASSPHRASE}}" }, | |
{"username": "git"}, | |
{"password": "${{ secrets.GITHUB_TOKEN }}"} | |
] | |
- name: Build with Maven | |
run: mvn --no-transfer-progress -B release:prepare release:perform -Prelease --file pom.xml | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |