Deploy to MVN Central #126
This file contains hidden or 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: Deploy to MVN Central | |
| env: | |
| CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} | |
| CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} | |
| CI_GPG_PASSPHRASE: ${{ secrets.CI_GPG_PASSPHRASE }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| releaseVersion: | |
| description: "Default version to use when preparing a release." | |
| required: true | |
| default: "X.Y" | |
| developmentVersion: | |
| description: "Default version to use for new local working copy." | |
| required: true | |
| default: "X.Y-SNAPSHOT" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v3 | |
| - name: Switch to master | |
| run: git switch -c release-${{ github.event.inputs.releaseVersion }} | |
| - name: Install Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20.x" | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.HOME }}/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| java-package: jdk | |
| distribution: temurin | |
| cache: 'maven' | |
| server-id: ossrh | |
| server-username: CI_DEPLOY_USERNAME | |
| server-password: CI_DEPLOY_PASSWORD | |
| gpg-private-key: ${{ secrets.CI_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: CI_GPG_PASSPHRASE | |
| - name: Configure git | |
| run: | | |
| gpg --list-keys | |
| git config --global committer.email "infra@finos.org" | |
| git config --global committer.name "FINOS Admin" | |
| git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| git config --global author.name "${GITHUB_ACTOR}" | |
| - name: Setup SSH Access for Commit | |
| uses: kielabokkie/ssh-key-and-known-hosts-action@v1.3.0 | |
| with: | |
| ssh-private-key: ${{ secrets.COMMIT_SSH_PRIVATE_KEY }} | |
| ssh-host: github.com | |
| - name: Build with Maven | |
| run: mvn --no-transfer-progress release:prepare release:perform -P sign-it -Dsign=true -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} |