From be7aeaaed43136a181b2ea390b892112a1cf5f16 Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Meyer Date: Sat, 16 Jan 2021 12:24:16 +0000 Subject: [PATCH] .github: fix release workflow Signed-off-by: Pierre-Alexandre Meyer --- .github/workflows/release.yml | 78 +++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94bad9fd..0c32db03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,69 @@ name: release on: - push: - tags: - - killbill-commons-* + workflow_dispatch: + inputs: + parent_version: + description: 'New killbill-oss-parent version' + required: false + default: '' + perform_version: + description: 'tag to (re-)perform (in case of release:perform failure)' + required: false + default: '' + +env: + MAVEN_FLAGS: "-B --no-transfer-progress" + MAVEN_OPTS: "-Xmx2G -XX:+ExitOnOutOfMemoryError -Dmaven.wagon.rto=60000 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3" jobs: release: runs-on: ubuntu-latest steps: - name: Checkout code + if: github.event.inputs.perform_version == '' + uses: actions/checkout@v2 + - name: Checkout full repository + # Required when performing an existing release + if: github.event.inputs.perform_version != '' uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: Setup git user + env: + BUILD_USER: ${{ secrets.BUILD_USER }} + BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} + run: | + git config --global user.email "contact@killbill.io" + git config --global user.name "Kill Bill core team" + git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:" - name: Configure Java + uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Configure Sonatype mirror + uses: s4u/maven-settings-action@v2.3.0 + # Go to Sonatype directly to avoid delay syncs (could get rid of this if actions/setup-java were to support mirrors) + with: + mirrors: '[{"id": "oss-releases", "name": "Sonatype releases", "mirrorOf": "*", "url": "https://oss.sonatype.org/content/repositories/releases/"}]' + - name: Download Java dependencies + # We do as much as we can, but it may not be enough (https://issues.apache.org/jira/browse/MDEP-82) + run: | + mvn ${MAVEN_FLAGS} clean install dependency:resolve dependency:resolve-plugins -DskipTests=true -Dgpg.skip=true -Psonatype-oss-release + - name: Update killbill-oss-parent + if: github.event.inputs.parent_version != '' + run: | + echo "Updating killbill-oss-parent pom.xml to ${{ github.event.inputs.parent_version }}:" + mvn ${MAVEN_FLAGS} versions:update-parent -DgenerateBackupPoms=false -DparentVersion="[${{ github.event.inputs.parent_version }}]" + echo "killbill-oss-parent pom.xml changes:" + git --no-pager diff + echo "Downloading new dependencies:" + mvn ${MAVEN_FLAGS} -U clean install -DskipTests=true + + git add pom.xml + # Will be pushed as part of the release process, only if the release is successful + git commit -m "pom.xml: update killbill-oss-parent to ${{ github.event.inputs.parent_version }}" + - name: Configure settings.xml for release uses: actions/setup-java@v1 with: java-version: 8 @@ -20,14 +72,24 @@ jobs: server-password: OSSRH_PASS gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} gpg-passphrase: GPG_PASSPHRASE - - name: Download Java dependencies - run: | - mvn -B --no-transfer-progress dependency:resolve -Psonatype-oss-release - mvn -B --no-transfer-progress dependency:resolve-plugins -Psonatype-oss-release - name: Release artifacts + if: github.event.inputs.perform_version == '' + env: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_PASS: ${{ secrets.OSSRH_PASS }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + mvn ${MAVEN_FLAGS} release:clean + mvn ${MAVEN_FLAGS} release:prepare + mvn ${MAVEN_FLAGS} release:perform + - name: Perform release + if: github.event.inputs.perform_version != '' env: OSSRH_USER: ${{ secrets.OSSRH_USER }} OSSRH_PASS: ${{ secrets.OSSRH_PASS }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + # https://issues.apache.org/jira/browse/SCM-729 run: | - mvn -B --no-transfer-progress release:perform -DconnectionUrl=scm:git:git@github.com:killbill/killbill-commons.git -Dtag=${GITHUB_REF#refs/*/} + echo "scm.url=scm\:git\:git@github.com\:${GITHUB_REPOSITORY}.git" > release.properties + echo "scm.tag=${{ github.event.inputs.perform_version }}" >> release.properties + mvn ${MAVEN_FLAGS} release:perform