diff --git a/.github/workflows/release-ga.yml b/.github/workflows/release-ga.yml new file mode 100644 index 00000000..e0810a31 --- /dev/null +++ b/.github/workflows/release-ga.yml @@ -0,0 +1,144 @@ +# full release workflow which does a staging build, github tagging, +# promotion in artifactory and release into central. +name: Release GA + +on: + workflow_dispatch: + +# there's 3 jobs, staging, promote and central. +# promote waits staging and manual approval and +# central waits promote and manual approval. +jobs: + + # build and release to staging repo. + # stash artifactory build id so that promote and central + # jobs can work on it. + staging: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - uses: jfrog/setup-jfrog-cli@v1 + with: + version: 1.50.0 + env: + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + # prepare env for cli to get a staging build working + - name: Configure JFrog Cli + run: | + jfrog rt gradlec \ + --use-wrapper \ + --deploy-ivy-desc=false \ + --server-id-resolve=repo.spring.io \ + --server-id-deploy=repo.spring.io \ + --repo-resolve=libs-release \ + --repo-deploy=libs-staging-local + echo JFROG_CLI_BUILD_NAME=spring-statemachine-22x-release >> $GITHUB_ENV + echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV + # switch from snapshot to a release version and extract project + # version to get used with tagging + - name: Configure Release Version + run: | + jfrog rt gradle releaseVersion + echo PROJECT_VERSION=$(jfrog rt gradle "properties -q" | grep "version:" | awk '{print $2}') >> $GITHUB_ENV + # build and publish to staging repo. + # we've allready tested with snapshots so no need to test + # with a release build as we are not a release train. + - name: Build and Publish + run: | + jfrog rt gradle clean build artifactoryPublish + jfrog rt build-publish + # we've now done a release build, branch and tag it in github + - name: Tag Release + uses: jvalkeal/build-zoo-handler@v0.0.4 + with: + tag-release-branch: ${{ env.PROJECT_VERSION }} + tag-release-tag: ${{ env.PROJECT_VERSION }} + tag-release-tag-prefix: v + + # wait manual approval. + # promote build from staging to releases + promote: + runs-on: ubuntu-latest + needs: staging + environment: promote + steps: + # need repo to push release branch and a tag + - uses: actions/checkout@v2 + - uses: jfrog/setup-jfrog-cli@v1 + with: + version: 1.50.0 + env: + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + # prepare env for cli to promote + - name: Configure JFrog Cli + run: | + jfrog rt gradlec \ + --use-wrapper \ + --deploy-ivy-desc=false \ + --server-id-resolve=repo.spring.io \ + --server-id-deploy=repo.spring.io \ + --repo-resolve=libs-release \ + --repo-deploy=libs-staging-local + echo JFROG_CLI_BUILD_NAME=spring-statemachine-22x-release >> $GITHUB_ENV + echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV + # promoting build from staging repo into release + - name: Promote Build + run: | + jfrog rt build-promote libs-release-local + # we've promoted so change repo to next dev version + - name: Switch to Next Dev Version + run: | + jfrog rt gradle nextVersion + - uses: jvalkeal/build-zoo-handler@v0.0.4 + with: + commit-changes-branch: 2.2.x + commit-changes-message: Next development version + + # wait manual approval. + # pull released artifacts from repo and do a dance with central sync where we + # create checksum and signature files, create staging repo and upload + # files into it, and then finally close and release that repo. + central: + runs-on: ubuntu-latest + needs: promote + environment: central + steps: + # need repo for spec file + - uses: actions/checkout@v2 + - uses: jfrog/setup-jfrog-cli@v1 + with: + version: 1.50.0 + env: + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + # prepare env for cli do download released files + - name: Configure JFrog Cli + run: | + echo JFROG_CLI_BUILD_NAME=spring-statemachine-22x-release >> $GITHUB_ENV + echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV + # download released files for a build. + # spec file defines files we actually need for central + # as release in artifactory contains some test and samples modules + # which we don't want in central. + - name: Download Release Files + run: | + jfrog rt download \ + --spec .github/release-files-spec.json \ + --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER" + # last step, sync to central. + - uses: jvalkeal/nexus-sync@v0 + with: + url: ${{ secrets.OSSRH_URL }} + username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} + create: true + upload: true + close: true + release: true + generate-checksums: true + pgp-sign: true + pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }} + pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY_WITH_HEADER }}