From ddfc43e4f0e02acf57c3a5f931e9c49bcfe4dab7 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Sun, 11 Jul 2021 14:07:33 +0100 Subject: [PATCH] Update release workflow --- .github/rlnotes.mustache | 24 +++++++++++++ .github/workflows/release-ga.yml | 62 ++++++++++++++++++++++++++++++-- 2 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 .github/rlnotes.mustache diff --git a/.github/rlnotes.mustache b/.github/rlnotes.mustache new file mode 100644 index 00000000..db043219 --- /dev/null +++ b/.github/rlnotes.mustache @@ -0,0 +1,24 @@ +{{#headerslength}} +# Generic Notes + +{{/headerslength}} +{{#headers}} +**{{title}}** +{{body}} + +{{/headers}} +# Issues + +{{#issues}} +{{repo}}#{{number}} {{title}} +{{/issues}} + +{{#footerslength}} +# Additional Notes + +{{/footerslength}} +{{#footers}} +**{{title}}** +{{body}} + +{{/footers}} diff --git a/.github/workflows/release-ga.yml b/.github/workflows/release-ga.yml index 1f9ae9b1..4fb90ba6 100644 --- a/.github/workflows/release-ga.yml +++ b/.github/workflows/release-ga.yml @@ -15,6 +15,8 @@ jobs: # jobs can work on it. staging: runs-on: ubuntu-latest + outputs: + project-version: ${{ steps.output.outputs.project-version }} steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -57,6 +59,12 @@ jobs: tag-release-branch: ${{ env.PROJECT_VERSION }} tag-release-tag: ${{ env.PROJECT_VERSION }} tag-release-tag-prefix: v + - name: Output + id: output + env: + PROJECT_VERSION: ${{ env.PROJECT_VERSION }} + run: | + echo "::set-output name=project-version::$PROJECT_VERSION" # wait manual approval. # promote build from staging to releases @@ -82,7 +90,7 @@ jobs: --server-id-deploy=repo.spring.io \ --repo-resolve=libs-release \ --repo-deploy=libs-staging-local - echo JFROG_CLI_BUILD_NAME=spring-statemachine-23x-release >> $GITHUB_ENV + 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 @@ -97,13 +105,63 @@ jobs: commit-changes-branch: 2.3.x commit-changes-message: Next development version + # gh release before central + ghrelease: + runs-on: ubuntu-latest + needs: [staging, promote] + steps: + - uses: actions/checkout@v2 + - name: Install Tooling + run: | + curl -sSL https://github.com/cbroglie/mustache/releases/download/v1.2.2/mustache_1.2.2_linux_amd64.tar.gz | sudo tar -C /usr/local/bin/ --no-same-owner -xzv mustache + - name: GitHub Release + env: + PROJECT_VERSION: ${{needs.staging.outputs.project-version}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5 + RELEASE_NOTES_DATA: ${{runner.temp}}/release_notes_data.json + RELEASE_NOTES_HEADERS: ${{runner.temp}}/release_notes_headers.json + RELEASE_NOTES_FOOTERS: ${{runner.temp}}/release_notes_footers.json + RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json + run: | + gh issue list \ + --repo spring-projects/spring-statemachine \ + --milestone $PROJECT_VERSION \ + --label automation/rlnotes-header \ + --state all --json title,body \ + --jq '{headers:map(.),headerslength:(length)}' \ + > $RELEASE_NOTES_HEADERS + gh issue list \ + --repo spring-projects/spring-statemachine \ + --milestone $PROJECT_VERSION \ + --label automation/rlnotes-footer \ + --state all --json title,body \ + --jq '{footers:map(.),footerslength:(length)}' \ + > $RELEASE_NOTES_FOOTERS + gh issue list \ + --repo spring-projects/spring-statemachine \ + --milestone $PROJECT_VERSION \ + --state all --json number,title,labels \ + --jq '{issues:map(select((.labels | length == 0) or (any(.labels[].name; startswith("automation/rlnotes")|not))))}' \ + > $RELEASE_NOTES_ISSUES + jq -s '{issues:(.[0].issues),headers:(.[1].headers),headerslength:(.[1].headerslength),footers:(.[2].footers), footerslength:(.[2].footerslength)}' \ + $RELEASE_NOTES_ISSUES \ + $RELEASE_NOTES_HEADERS \ + $RELEASE_NOTES_FOOTERS \ + > $RELEASE_NOTES_DATA + mustache $RELEASE_NOTES_DATA .github/rlnotes.mustache > $RELEASE_NOTES_FILE + gh release create v$PROJECT_VERSION \ + --draft \ + --title "$PROJECT_VERSION" \ + --notes-file $RELEASE_NOTES_FILE + # 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 + needs: ghrelease environment: central steps: # need repo for spec file