Skip to content

Commit 4319443

Browse files
committed
Update workflows
1 parent b9ca500 commit 4319443

File tree

4 files changed

+50
-9
lines changed

4 files changed

+50
-9
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: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,52 @@ 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+
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
1520
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
1831

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'
1951
runs-on: ubuntu-latest
2052
steps:
2153
- name: Checkout

.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)