Release #9
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
forceVersion: | |
description: 'Force version' | |
required: false | |
default: '' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
- name: Release | |
if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.createNewRelease != 'false'}} | |
run: ./gradlew --no-daemon release -Prelease.customPassword=${GITHUB_TOKEN} -Prelease.customUsername=${GITHUB_ACTOR} -Prelease.forceVersion=${FORCE_VERSION} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FORCE_VERSION: ${{ github.event.inputs.forceVersion }} | |
- name: Publish to Sonatype | |
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }} | |
- name: Log new version | |
id: 'next-version' | |
run: | | |
NEW_MMS_VERSION="`./gradlew -q cV -Prelease.quiet`" | |
echo "new_mms_version=$NEW_MMS_VERSION" >> $GITHUB_OUTPUT | |
echo "New mongo-migration-stream version: ${NEW_MMS_VERSION}" | |
- name: Build fatJar | |
if: github.ref == 'refs/heads/main' | |
run: ./gradlew :mongo-migration-stream-cli:main shadowJar | |
- name: Create release on GitHub | |
if: github.ref == 'refs/heads/main' | |
run: gh release create ${{ steps.next-version.outputs.new_mms_version }} --generate-notes ./mongo-migration-stream-cli/build/libs/mongo-migration-stream-cli.jar | |
env: | |
GH_TOKEN: ${{ github.token }} |