2022-05-04 15:05:14 -04:00
|
|
|
name: Update Scheduled Release Version
|
2022-01-13 08:07:42 -05:00
|
|
|
|
|
|
|
on:
|
2022-05-04 15:05:14 -04:00
|
|
|
workflow_dispatch: # Manual trigger only. Triggered by release-scheduler.yml on main.
|
2022-01-13 08:07:42 -05:00
|
|
|
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
|
|
|
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
|
|
|
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
|
|
|
|
2022-07-26 16:31:10 -04:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-01-13 08:07:42 -05:00
|
|
|
jobs:
|
2022-05-04 15:05:14 -04:00
|
|
|
update_scheduled_release_version:
|
2022-04-20 15:20:22 -04:00
|
|
|
name: Initiate Release If Scheduled
|
2022-05-16 13:13:25 -04:00
|
|
|
if: ${{ github.repository == 'spring-projects/spring-security' }}
|
2022-01-13 08:07:42 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-26 16:31:10 -04:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
actions: read
|
2022-01-13 08:07:42 -05:00
|
|
|
steps:
|
2022-04-20 15:20:22 -04:00
|
|
|
- id: checkout-source
|
|
|
|
name: Checkout Source Code
|
2022-11-24 22:37:39 -05:00
|
|
|
uses: actions/checkout@v3
|
2022-04-20 15:20:22 -04:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
2022-07-27 12:07:42 -04:00
|
|
|
- name: Set up gradle
|
|
|
|
uses: spring-io/spring-gradle-build-action@v1
|
2022-01-13 08:07:42 -05:00
|
|
|
with:
|
|
|
|
java-version: '17'
|
2022-07-27 12:07:42 -04:00
|
|
|
distribution: 'temurin'
|
2022-04-20 15:20:22 -04:00
|
|
|
- id: check-release-due
|
|
|
|
name: Check Release Due
|
2022-03-01 08:55:36 -05:00
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
|
|
|
./gradlew gitHubCheckNextVersionDueToday
|
2022-11-24 22:37:39 -05:00
|
|
|
echo "is_due_today=$(cat build/github/milestones/is-due-today)" >>$GITHUB_OUTPUT
|
2022-04-20 15:20:22 -04:00
|
|
|
- id: check-open-issues
|
|
|
|
name: Check for open issues
|
2022-05-16 15:21:49 -04:00
|
|
|
if: steps.check-release-due.outputs.is_due_today == 'true'
|
2022-03-01 10:08:09 -05:00
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
|
|
|
./gradlew gitHubCheckMilestoneHasNoOpenIssues
|
2022-11-24 22:37:39 -05:00
|
|
|
echo "is_open_issues=$(cat build/github/milestones/is-open-issues)" >>$GITHUB_OUTPUT
|
2022-04-20 15:20:22 -04:00
|
|
|
- id: validate-release-state
|
|
|
|
name: Validate State of Release
|
2022-05-16 15:22:36 -04:00
|
|
|
if: steps.check-release-due.outputs.is_due_today == 'true' && steps.check-open-issues.outputs.is_open_issues == 'true'
|
2022-01-13 08:07:42 -05:00
|
|
|
run: |
|
2022-04-20 15:20:22 -04:00
|
|
|
echo "The release is due today but there are open issues"
|
|
|
|
exit 1
|
|
|
|
- id: update-version-and-push
|
|
|
|
name: Update version and push
|
2022-05-16 15:22:36 -04:00
|
|
|
if: steps.check-release-due.outputs.is_due_today == 'true' && steps.check-open-issues.outputs.is_open_issues == 'false'
|
2022-01-13 08:07:42 -05:00
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
2022-04-20 15:20:22 -04:00
|
|
|
git config user.name 'github-actions[bot]'
|
|
|
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
2022-03-28 11:43:59 -04:00
|
|
|
./gradlew :updateProjectVersion
|
|
|
|
updatedVersion=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
|
2022-03-29 06:17:47 -04:00
|
|
|
git commit -am "Release $updatedVersion"
|
2022-03-29 07:44:22 -04:00
|
|
|
git tag $updatedVersion
|
2022-03-01 10:08:09 -05:00
|
|
|
git push
|
2022-04-26 04:10:27 -04:00
|
|
|
git push origin $updatedVersion
|
2022-04-20 15:20:22 -04:00
|
|
|
- id: send-slack-notification
|
|
|
|
name: Send Slack message
|
|
|
|
if: failure()
|
2022-01-13 08:07:42 -05:00
|
|
|
uses: Gamesight/slack-workflow-status@v1.0.1
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
channel: '#spring-security-ci'
|
|
|
|
name: 'CI Notifier'
|