2022-01-13 08:07:42 -05:00
|
|
|
name: Release Next Version
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
2022-03-18 12:06:47 -04:00
|
|
|
- cron: '0 17 * * MON' # Every Monday at 5pm UTC
|
2022-01-13 08:07:42 -05:00
|
|
|
workflow_dispatch: # Manual trigger
|
|
|
|
|
|
|
|
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 }}
|
|
|
|
RUN_JOBS: ${{ github.repository == 'spring-projects/spring-security' }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
prerequisites:
|
|
|
|
name: Pre-requisites for building
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
runjobs: ${{ steps.continue.outputs.runjobs }}
|
|
|
|
steps:
|
|
|
|
- id: continue
|
|
|
|
name: Determine if should continue
|
|
|
|
if: env.RUN_JOBS == 'true'
|
|
|
|
run: echo "::set-output name=runjobs::true"
|
|
|
|
check_release_due:
|
|
|
|
name: Check if the release is due today
|
|
|
|
needs: [prerequisites]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: needs.prerequisites.outputs.runjobs
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK 17
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: '17'
|
|
|
|
- name: Setup gradle user name
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.gradle
|
|
|
|
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
|
|
|
|
- name: Cache Gradle packages
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.gradle/caches
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
|
|
|
- name: Check release
|
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-03-01 10:08:09 -05:00
|
|
|
check_open_issues:
|
|
|
|
name: Ensure there are no open issues
|
|
|
|
needs: [check_release_due]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK 17
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: '17'
|
|
|
|
- name: Setup gradle user name
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.gradle
|
|
|
|
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
|
|
|
|
- name: Check for open issues
|
|
|
|
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-01-13 08:07:42 -05:00
|
|
|
release:
|
|
|
|
name: Release next version
|
2022-03-01 10:08:09 -05:00
|
|
|
needs: [check_release_due, check_open_issues]
|
2022-01-13 08:07:42 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: '17'
|
|
|
|
- name: Setup gradle user name
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.gradle
|
|
|
|
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
|
2022-03-01 10:08:09 -05:00
|
|
|
- name: Setup git config
|
|
|
|
run: |
|
|
|
|
git config user.name 'github-actions[bot]'
|
|
|
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
- name: Update version and push
|
2022-03-28 11:43:59 -04:00
|
|
|
# antoraUpdateVersion can only be run after updateProjectVersion completes, in order get the updated project version
|
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-03-28 11:43:59 -04:00
|
|
|
./gradlew :updateProjectVersion
|
|
|
|
./gradlew :spring-security-docs:antoraUpdateVersion
|
|
|
|
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-01-13 08:07:42 -05:00
|
|
|
notify_result:
|
|
|
|
name: Check for failures
|
|
|
|
needs: [release]
|
|
|
|
if: failure()
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Send Slack message
|
|
|
|
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'
|