From 7c726110dedb01d5cfe40b093fc244f9d7c7f91a Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Sun, 18 Sep 2022 01:16:55 -0500 Subject: [PATCH] Add github-release.yml --- .github/rlnotes.mustache | 5 +++ .github/workflows/github-release.yml | 50 +++++++++++++++++++++++++++ .github/workflows/prepare-release.yml | 2 +- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/rlnotes.mustache create mode 100644 .github/workflows/github-release.yml diff --git a/.github/rlnotes.mustache b/.github/rlnotes.mustache new file mode 100644 index 00000000..21831cdf --- /dev/null +++ b/.github/rlnotes.mustache @@ -0,0 +1,5 @@ +# Issues + +{{#issues}} +{{repo}}#{{number}} {{title}} +{{/issues}} diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 00000000..d9cdf8a8 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,50 @@ +name: Github Release + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: 'Version to release' + required: true + type: string + +jobs: + github-release: + if: github.repository == 'spring-projects-experimental/spring-pulsar' + runs-on: ubuntu-latest + steps: + - id: checkout-source + name: Checkout Source Code + uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} + - name: Set up gradle + uses: spring-io/spring-gradle-build-action@v1 + with: + java-version: '17' + distribution: 'temurin' + - 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: Create Release + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json + RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5 + run: | + releaseVersion="${{ inputs.releaseVersion }}" + + gh issue list \ + --repo spring-projects-experimental/spring-pulsar \ + --state all --json number,title,labels \ + --search milestone:$releaseVersion \ + --jq '{issues:map(select((.labels | length == 0) or (any(.labels[].name; startswith("automation/rlnotes")|not))) + {repo:"spring-projects-experimental/spring-pulsar"})}' \ + > $RELEASE_NOTES_ISSUES + + mustache $RELEASE_NOTES_ISSUES .github/rlnotes.mustache > $RELEASE_NOTES_FILE + + gh release create $releaseVersion \ + --draft \ + --title "Spring Pulsar $releaseVersion" \ + --generate-notes \ + --notes-file $RELEASE_NOTES_FILE diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 67eddfdb..b14ed215 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -50,7 +50,7 @@ jobs: git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' releaseVersion="${{ inputs.releaseVersion }}" - releaseBranch="release/$releaseVersion" + releaseBranch="release-initiate/$releaseVersion" git checkout -b $releaseBranch currentVersion=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}') echo "Updating version from $currentVersion to $releaseVersion"