update-scheduled-release-version.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: Update Scheduled Release Version
  2. on:
  3. workflow_dispatch: # Manual trigger only. Triggered by release-scheduler.yml on main.
  4. env:
  5. DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
  6. permissions:
  7. contents: read
  8. jobs:
  9. update_scheduled_release_version:
  10. name: Initiate Release If Scheduled
  11. if: ${{ github.repository == 'spring-projects/spring-security' }}
  12. runs-on: ubuntu-latest
  13. permissions:
  14. contents: read
  15. actions: read
  16. steps:
  17. - id: checkout-source
  18. name: Checkout Source Code
  19. uses: actions/checkout@v4
  20. with:
  21. token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
  22. - name: Set up gradle
  23. uses: spring-io/spring-gradle-build-action@v2
  24. with:
  25. java-version: '11'
  26. distribution: 'adopt'
  27. - id: check-release-due
  28. name: Check Release Due
  29. run: |
  30. ./gradlew gitHubCheckNextVersionDueToday
  31. echo "is_due_today=$(cat build/github/milestones/is-due-today)" >>$GITHUB_OUTPUT
  32. - id: check-open-issues
  33. name: Check for open issues
  34. if: steps.check-release-due.outputs.is_due_today == 'true'
  35. run: |
  36. ./gradlew gitHubCheckMilestoneHasNoOpenIssues
  37. echo "is_open_issues=$(cat build/github/milestones/is-open-issues)" >>$GITHUB_OUTPUT
  38. - id: validate-release-state
  39. name: Validate State of Release
  40. if: steps.check-release-due.outputs.is_due_today == 'true' && steps.check-open-issues.outputs.is_open_issues == 'true'
  41. run: |
  42. echo "The release is due today but there are open issues"
  43. exit 1
  44. - id: update-version-and-push
  45. name: Update version and push
  46. if: steps.check-release-due.outputs.is_due_today == 'true' && steps.check-open-issues.outputs.is_open_issues == 'false'
  47. run: |
  48. git config user.name 'github-actions[bot]'
  49. git config user.email 'github-actions[bot]@users.noreply.github.com'
  50. ./gradlew :updateProjectVersion
  51. updatedVersion=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
  52. git commit -am "Release $updatedVersion"
  53. git tag $updatedVersion
  54. git push
  55. git push origin $updatedVersion
  56. send-notification:
  57. name: Send Notification
  58. needs: [ update_scheduled_release_version ]
  59. if: ${{ failure() || cancelled() }}
  60. runs-on: ubuntu-latest
  61. steps:
  62. - name: Send Notification
  63. uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
  64. with:
  65. webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}