Kaynağa Gözat

Add workflow step for scheduling the next milestone

This step introduces the concept of a release train to determine the appropriate release dates and schedules milestones as needed. It uses the following rules:

- If the current SNAPSHOT version is a minor release (patchVersion == 0), checks to see if a GA release exists. If not, a release train is scheduled as follows:
  - Finds the next available release train starting month (including this month), either January or July.
  - Schedules a release train with M1, M2, M3, RC1 and GA versions on either January/February/March/April/May or July/August/September/October/November
- If the current SNAPSHOT version is a patch release (patchVersion != 0), checks to see if a GA release exists. If not, an individual milestone is scheduled on the next even month whose release day is in the future (can include this month).
- In either case, the release day used to schedule the release is based on the configured weekOfMonth (1-4) and dayOfWeek (1-5), e.g. 3rd Monday of the month (3, 1).

If a milestone already exists, nothing is created. Once created, milestone due dates can be updated manually as desired.

Closes gh-10458
Steve Riesenberg 3 yıl önce
ebeveyn
işleme
46723a601c

+ 18 - 2
.github/workflows/continuous-integration-workflow.yml

@@ -232,8 +232,8 @@ jobs:
           DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
           DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
           DOCS_HOST: ${{ secrets.DOCS_HOST }}
-  create_release:
-    name: Create GitHub Release
+  perform_release:
+    name: Perform release
     needs: [prerequisites, deploy_artifacts, deploy_docs, deploy_schema]
     runs-on: ubuntu-latest
     timeout-minutes: 90
@@ -245,6 +245,8 @@ jobs:
       VERSION: ${{ needs.prerequisites.outputs.project_version }}
     steps:
       - uses: actions/checkout@v2
+        with:
+          token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
       - name: Set up JDK
         uses: actions/setup-java@v1
         with:
@@ -298,6 +300,20 @@ jobs:
           ./gradlew :spring-security-docs:antoraUpdateVersion
           git commit -am "Next development version"
           git push
+  perform_post_release:
+    name: Perform post-release
+    needs: [prerequisites, deploy_artifacts, deploy_docs, deploy_schema]
+    runs-on: ubuntu-latest
+    timeout-minutes: 90
+    if: ${{ endsWith(needs.prerequisites.outputs.project_version, '-SNAPSHOT') }}
+    env:
+      TOKEN: ${{ github.token }}
+      VERSION: ${{ needs.prerequisites.outputs.project_version }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: spring-io/spring-gradle-build-action@v1
+      - name: Schedule next release (if not already scheduled)
+        run: ./gradlew scheduleNextRelease -PnextVersion=$VERSION -PgitHubAccessToken=$TOKEN
   notify_result:
     name: Check for failures
     needs: [build_jdk_17, snapshot_tests, check_samples, check_tangles, deploy_artifacts, deploy_docs, deploy_schema, create_release]

+ 5 - 0
buildSrc/src/main/java/org/springframework/gradle/github/milestones/ScheduleNextReleaseTask.java

@@ -19,6 +19,7 @@ package org.springframework.gradle.github.milestones;
 import java.time.LocalDate;
 import java.time.LocalTime;
 
+import org.gradle.api.Action;
 import org.gradle.api.DefaultTask;
 import org.gradle.api.tasks.Input;
 import org.gradle.api.tasks.TaskAction;
@@ -104,6 +105,10 @@ public class ScheduleNextReleaseTask extends DefaultTask {
 		return this.repository;
 	}
 
+	public void repository(Action<RepositoryRef> repository) {
+		repository.execute(this.repository);
+	}
+
 	public void setRepository(RepositoryRef repository) {
 		this.repository = repository;
 	}