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