File tree Expand file tree Collapse file tree 4 files changed +50
-9
lines changed Expand file tree Collapse file tree 4 files changed +50
-9
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ name: Gradle Build
3
3
# workflow limited to only files related to gradle build itself
4
4
on :
5
5
push :
6
- branches : [ "main" ]
6
+ branches :
7
+ - " main"
8
+ - " feature/*"
9
+ - " release/*"
7
10
paths :
8
11
- " problem4j-spring-*/build.gradle.kts"
9
12
- " problem4j-spring-*/src/**"
16
19
- " gradlew.bat"
17
20
- " .github/workflows/gradle-build.yml"
18
21
pull_request :
19
- branches : [ "main" ]
22
+ branches :
23
+ - " main"
24
+ - " release/*"
20
25
21
26
jobs :
22
27
build :
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ name: Dependency Submission
3
3
# workflow limited to only files related to gradle dependencies
4
4
on :
5
5
push :
6
- branches : [ "main" ]
6
+ branches :
7
+ - " main"
8
+ - " release/*"
7
9
paths :
8
10
- " problem4j-spring-*/build.gradle.kts"
9
11
- " build.gradle.kts"
Original file line number Diff line number Diff line change @@ -2,20 +2,52 @@ name: Gradle Publish [snapshot]
2
2
3
3
on :
4
4
workflow_dispatch :
5
+ schedule :
6
+ - cron : " 0 15 * * 5" # friday 15:00 UTC
5
7
6
8
jobs :
7
9
check-branch :
8
10
runs-on : ubuntu-latest
9
11
steps :
10
12
- name : Check Branch
11
- if : github.ref != 'refs/heads/main'
13
+ if : startsWith( github.ref, 'refs/heads/')
12
14
run : |
13
- echo "::error title=wrong branch selected::this workflow must be run on the 'main' branch"
14
- exit 1
15
+ BRANCH="${GITHUB_REF#refs/heads/}"
16
+ if [[ "$BRANCH" != "main" && "$BRANCH" != release/* ]]; then
17
+ echo "::error title=wrong branch selected::this workflow must be run on 'main' or 'release/*' branches"
18
+ exit 1
19
+ fi
15
20
16
- publish-snapshot :
17
- needs : check-branch
21
+ check-updates :
22
+ runs-on : ubuntu-latest
23
+ outputs :
24
+ should_run : ${{ steps.check.outputs.should_run }}
25
+ steps :
26
+ - name : Checkout
27
+ uses : actions/checkout@v5
28
+ with :
29
+ ref : main
30
+ fetch-depth : 50
18
31
32
+ - name : Check if SNAPSHOT publish is applicable
33
+ id : check
34
+ run : |
35
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
36
+ echo "::notice::publish will always execute on manual trigger"
37
+ echo "should_run=true" >> $GITHUB_OUTPUT
38
+ else
39
+ if git log --since="7 days ago" --oneline | grep .; then
40
+ echo "::notice::commits found within last 7 days window, publish will execute"
41
+ echo "should_run=true" >> $GITHUB_OUTPUT
42
+ else
43
+ echo "::notice::no commits found within last 7 days window, publish will abort"
44
+ echo "should_run=false" >> $GITHUB_OUTPUT
45
+ fi
46
+ fi
47
+
48
+ publish-snapshot :
49
+ needs : [ check-branch, check-updates ]
50
+ if : needs.check-updates.outputs.should_run == 'true'
19
51
runs-on : ubuntu-latest
20
52
steps :
21
53
- name : Checkout
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ name: Validate [next_version.txt]
2
2
3
3
on :
4
4
push :
5
- branches : [ "main" ]
5
+ branches :
6
+ - " main"
7
+ - " release/*"
6
8
paths :
7
9
- " .github/utils/next_version.txt"
8
10
- " .github/utils/validate_version_file.sh"
You can’t perform that action at this time.
0 commit comments