Skip to content

Commit a059047

Browse files
committed
Update README.md and workflows
1 parent b9ca500 commit a059047

File tree

6 files changed

+542
-512
lines changed

6 files changed

+542
-512
lines changed

.github/workflows/gradle-build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name: Gradle Build
33
# workflow limited to only files related to gradle build itself
44
on:
55
push:
6-
branches: [ "main" ]
6+
branches:
7+
- "main"
8+
- "feature/*"
9+
- "release/*"
710
paths:
811
- "problem4j-spring-*/build.gradle.kts"
912
- "problem4j-spring-*/src/**"
@@ -16,7 +19,9 @@ on:
1619
- "gradlew.bat"
1720
- ".github/workflows/gradle-build.yml"
1821
pull_request:
19-
branches: [ "main" ]
22+
branches:
23+
- "main"
24+
- "release/*"
2025

2126
jobs:
2227
build:

.github/workflows/gradle-dependency-submission.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Dependency Submission
33
# workflow limited to only files related to gradle dependencies
44
on:
55
push:
6-
branches: [ "main" ]
6+
branches:
7+
- "main"
8+
- "release/*"
79
paths:
810
- "problem4j-spring-*/build.gradle.kts"
911
- "build.gradle.kts"

.github/workflows/gradle-publish-snapshot.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,55 @@ name: Gradle Publish [snapshot]
22

33
on:
44
workflow_dispatch:
5+
schedule:
6+
- cron: "0 15 * * 5" # friday 15:00 UTC
57

68
jobs:
79
check-branch:
810
runs-on: ubuntu-latest
911
steps:
1012
- name: Check Branch
11-
if: github.ref != 'refs/heads/main'
13+
if: startsWith(github.ref, 'refs/heads/')
1214
run: |
13-
echo "::error title=wrong branch selected::this workflow must be run on the 'main' branch"
14-
exit 1
15-
16-
publish-snapshot:
17-
needs: check-branch
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
1820
21+
check-updates:
1922
runs-on: ubuntu-latest
23+
outputs:
24+
should_run: ${{ steps.check.outputs.should_run }}
2025
steps:
2126
- name: Checkout
2227
uses: actions/checkout@v5
2328
with:
24-
ref: main
29+
fetch-depth: 50
30+
31+
- name: Check if SNAPSHOT publish is applicable
32+
id: check
33+
run: |
34+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
35+
echo "::notice::publish will always execute on manual trigger"
36+
echo "should_run=true" >> $GITHUB_OUTPUT
37+
else
38+
if git log --since="7 days ago" --oneline | grep .; then
39+
echo "::notice::commits found within last 7 days window, publish will execute"
40+
echo "should_run=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "::notice::no commits found within last 7 days window, publish will abort"
43+
echo "should_run=false" >> $GITHUB_OUTPUT
44+
fi
45+
fi
46+
47+
publish-snapshot:
48+
needs: [ check-branch, check-updates ]
49+
if: needs.check-updates.outputs.should_run == 'true'
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v5
2554

2655
- name: Set up JDK 17
2756
uses: actions/setup-java@v5

.github/workflows/validate-next_version.txt.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Validate [next_version.txt]
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches:
6+
- "main"
7+
- "release/*"
68
paths:
79
- ".github/utils/next_version.txt"
810
- ".github/utils/validate_version_file.sh"

0 commit comments

Comments
 (0)