From ebfd45ec476534533e9c8dc2cf0c059ff9787b65 Mon Sep 17 00:00:00 2001 From: Tihomir Mateev Date: Fri, 7 Jun 2024 20:51:34 +0300 Subject: [PATCH] Modify the release acrtion to call the proper maven target for release, make releasing manually available too --- .github/workflows/version-and-release.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/version-and-release.yaml b/.github/workflows/version-and-release.yaml index 7f0fa2cd74..93ee19348b 100644 --- a/.github/workflows/version-and-release.yaml +++ b/.github/workflows/version-and-release.yaml @@ -2,23 +2,25 @@ name: Release on: release: - types: [published] + types: [published] # once a release is published in the GitHub UI + workflow_dispatch: # or manually, by clicking the button jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: 1. Checkout sources + uses: actions/checkout@v4 - - name: get version from tag + - name: 2. Extract version from tag id: get_version run: | realversion="${GITHUB_REF/refs\/tags\//}" realversion="${realversion//v/}" echo "VERSION=$realversion" >> $GITHUB_OUTPUT - - name: Set up publishing to maven central + - name: 3. Set up Java with Maven cache uses: actions/setup-java@v4 with: java-version: '8' @@ -28,20 +30,20 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD - - name: mvn versions + - name: 4. Update version in Maven configuration run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }} - - name: Install gpg key + - name: 5. Install GPG key run: | cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - - name: Publish + - name: 6. Publish to Maven run: | mvn --no-transfer-progress \ --batch-mode \ -Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \ - deploy -P release + release:perform env: MAVEN_USERNAME: ${{secrets.OSSH_USERNAME}} - MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}} \ No newline at end of file + MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}}