From fb40ca1ec5d97b0729f47bfaaa945dd326b8e935 Mon Sep 17 00:00:00 2001 From: Andrew Forward Date: Fri, 8 Sep 2023 14:25:25 -0400 Subject: [PATCH] More testing --- .github/workflows/release.yml | 102 +++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cda05fb..6ef0e466 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,56 +28,68 @@ jobs: needs: setup runs-on: ubuntu-latest steps: - - name: Show Variables + - name: Show OSSRH_USERNAME run: | echo "Using OSSRH_USERNAME ${{ secrets.OSSRH_USERNAME }}" - echo "AND OSSRH_PASSWORD ${{ secrets.OSSRH_PASSWORD }}" - echo "AND X ${{ secrets.X }}" + - name: Check if OSSRH_PASSWORD is available + run: | + if [[ -z "${{ secrets.OSSRH_PASSWORD }}" ]]; then + echo "OSSRH_PASSWORD is not available!" + else + echo "OSSRH_PASSWORD is available." + fi + - name: Check if MAVEN_GPG_PASSPHRASE is available + run: | + if [[ -z "${{ secrets.MAVEN_GPG_PASSPHRASE }}" ]]; then + echo "MAVEN_GPG_PASSPHRASE is not available!" + else + echo "MAVEN_GPG_PASSPHRASE is available." + fi # Run for manual trigger (workflow dispatch), since you'll have release and next dev versions specified # All commits will have a -SNAPSHOT project version anyway, since the releases will be handled here - # release: - # needs: check_vars - # if: github.event_name == 'workflow_dispatch' - # runs-on: ubuntu-latest - # env: - # RELEASE: ${{ inputs.releaseversion }} - # NEXT: ${{ inputs.nextversion }} - # steps: - # - name: Checkout latest code - # uses: actions/checkout@v3 + release: + needs: check_vars + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + env: + RELEASE: ${{ inputs.releaseversion }} + NEXT: ${{ inputs.nextversion }} + steps: + - name: Checkout latest code + uses: actions/checkout@v3 - # - name: Config git user - # run: | - # git config user.name ${{ github.actor }} - # git config user.email "${{ github.actor }}@users.noreply.github.com" + - name: Config git user + run: | + git config user.name ${{ github.actor }} + git config user.email "${{ github.actor }}@users.noreply.github.com" - # - name: Setup Java & Maven - # uses: actions/setup-java@v3 - # with: - # java-version: 17 - # distribution: 'temurin' - # cache: 'maven' - # server-id: ossrh - # server-username: MAVEN_USERNAME - # server-password: MAVEN_PASSWORD - # gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }} - # gpg-passphrase: MAVEN_GPG_PASSPHRASE - # # ============================================================================= - # # Start the release - # # ============================================================================= - # - name: Release main POM - # run: | - # mvn -B -U -V -ntp release:prepare -DreleaseVersion=$RELEASE -Dtag=$RELEASE -DdevelopmentVersion=$NEXT -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - # mvn -B -U -V -ntp release:perform -P release -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - # env: - # MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - # MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - # MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: Setup Java & Maven + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + # ============================================================================= + # Start the release + # ============================================================================= + - name: Release main POM + run: | + mvn -B -U -V -ntp release:prepare -DreleaseVersion=$RELEASE -Dtag=$RELEASE -DdevelopmentVersion=$NEXT -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + mvn -B -U -V -ntp release:perform -P release -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - # - name: Build and publish new dev version - # run: mvn -B -U -V -ntp deploy -P release - # env: - # MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - # MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - # MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: Build and publish new dev version + run: mvn -B -U -V -ntp deploy -P release + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}