From de5fae376564c9c1820c509d1d03e97640664391 Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Wed, 19 Feb 2025 12:45:13 -0600 Subject: [PATCH] Migrate away from third-party GChat Github action This replaces the 'julb/action-post-googlechat-message' Github action with simple curl call. Resolves #857 --- .github/workflows/ci.yml | 8 +- .github/workflows/release-ad-hoc.yml | 109 --------------------------- 2 files changed, 4 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/release-ad-hoc.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf620853..99059af6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,11 +207,11 @@ jobs: --generate-notes \ --notes-file $RELEASE_NOTES_FILE - name: Announce Release in Chat - uses: julb/action-post-googlechat-message@v1 if: env.GCHAT_WEBHOOK_URL - with: - message: "spring-pulsar-announcing `${{ env.VERSION }}`" - gchat_webhook_url: ${{ env.GCHAT_WEBHOOK_URL }} + run: | + curl -X POST '${{ env.GCHAT_WEBHOOK_URL }}' \ + -H 'Content-Type: application/json' \ + -d '{ text: "${{ github.event.repository.name }}-announcing `${{ env.VERSION }}`"}' - name: Update next snapshot version run: | echo "Updating $REPO@$VERSION to next snapshot version." diff --git a/.github/workflows/release-ad-hoc.yml b/.github/workflows/release-ad-hoc.yml deleted file mode 100644 index 022c9d65..00000000 --- a/.github/workflows/release-ad-hoc.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Ad Hoc Release - -on: - workflow_dispatch: - -env: - GCHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }} - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} - COMMIT_OWNER: ${{ github.event.pusher.name }} - COMMIT_SHA: ${{ github.sha }} - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - -jobs: - prerequisites: - name: Pre-requisites for building - runs-on: ubuntu-latest - if: github.repository == 'spring-projects/spring-pulsar' - outputs: - runjobs: ${{ steps.continue.outputs.runjobs }} - project_version: ${{ steps.continue.outputs.project_version }} - boot_version: ${{ steps.continue.outputs.boot_version }} - steps: - - uses: actions/checkout@v4 - - id: continue - name: Determine if should continue - run: | - # Run jobs if in upstream repository - echo "runjobs=true" >>$GITHUB_OUTPUT - # Extract version from gradle.properties - version=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}') - echo "project_version=$version" >>$GITHUB_OUTPUT - bootVersion=$(cat gradle/libs.versions.toml | grep "spring-boot = \"" | cut -d '"' -f2) - echo "boot_version=$bootVersion" >>$GITHUB_OUTPUT - perform_release: - name: Perform Release - needs: [prerequisites] - runs-on: ubuntu-latest - permissions: - contents: write - timeout-minutes: 120 - if: ${{ !endsWith(needs.prerequisites.outputs.project_version, '-SNAPSHOT') }} - env: - REPO: ${{ github.repository }} - BRANCH: ${{ github.ref_name }} - VERSION: ${{ needs.prerequisites.outputs.project_version }} - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} - - uses: spring-io/spring-gradle-build-action@v2 - - name: Wait for Artifactory artifacts (milestone) - if: ${{ contains(needs.prerequisites.outputs.project_version, '-RC') || contains(needs.prerequisites.outputs.project_version, '-M') }} - run: | - echo "Wait for artifacts of $REPO@$VERSION to appear on Artifactory." - until curl -f -s https://repo.spring.io/artifactory/milestone/org/springframework/pulsar/spring-pulsar/$VERSION/ > /dev/null - do - sleep 30 - echo "." - done - echo "Artifacts for $REPO@$VERSION have been released to Artifactory." - - name: Wait for Maven Central artifacts (GA) - if: ${{ !contains(needs.prerequisites.outputs.project_version, '-SNAPSHOT') && !contains(needs.prerequisites.outputs.project_version, '-RC') && !contains(needs.prerequisites.outputs.project_version, '-M') }} - run: | - echo "Wait for artifacts of $REPO@$VERSION to appear on Maven Central." - until curl -f -s https://repo1.maven.org/maven2/org/springframework/pulsar/spring-pulsar/$VERSION/ > /dev/null - do - sleep 30 - echo "." - done - echo "Artifacts for $REPO@$VERSION have been released to Maven Central." - - name: Setup git for release tagging - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - - name: Tag release - run: | - echo "Tagging $REPO@$VERSION release." - git tag v$VERSION - git push --tags origin - - name: Install tooling for Github release - run: | - curl -sSL -O https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.10/github-changelog-generator.jar - - name: Create Github release - env: - RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5 - GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} - run: | - java -jar github-changelog-generator.jar \ - --spring.config.location=.github/changelog-generator.yml \ - $VERSION $RELEASE_NOTES_FILE - cat $RELEASE_NOTES_FILE - gh release create v$VERSION \ - --draft \ - --title "Spring Pulsar $VERSION" \ - --generate-notes \ - --notes-file $RELEASE_NOTES_FILE - - name: Announce Release in Chat - uses: julb/action-post-googlechat-message@v1 - if: env.GCHAT_WEBHOOK_URL - with: - message: "spring-pulsar-announcing `${{ env.VERSION }}`" - gchat_webhook_url: ${{ env.GCHAT_WEBHOOK_URL }} - - name: Update next snapshot version - run: | - echo "Updating $REPO@$VERSION to next snapshot version." - ./gradlew :updateToSnapshotVersion - git commit -am "[Release $VERSION] Next development version" - git push