Skip to content

Commit cacbd51

Browse files
committed
Explore weekly snapshot builds
1 parent e73a53f commit cacbd51

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

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

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

33
on:
44
workflow_dispatch:
5-
5+
schedule:
6+
- cron: "0 15 * * 5" # friday 15:00 UTC
67
jobs:
78
check-branch:
89
runs-on: ubuntu-latest
@@ -13,9 +14,36 @@ jobs:
1314
echo "::error title=wrong branch selected::this workflow must be run on the 'main' branch"
1415
exit 1
1516
16-
publish-snapshot:
17-
needs: check-branch
17+
check-updates:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
should_run: ${{ steps.check.outputs.should_run }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v5
24+
with:
25+
ref: main
26+
fetch-depth: 50
27+
28+
- name: Check if SNAPSHOT publish is applicable
29+
id: check
30+
run: |
31+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
32+
echo "::notice::publish will always execute on manual trigger"
33+
echo "should_run=true" >> $GITHUB_OUTPUT
34+
else
35+
if git log --since="7 days ago" --oneline | grep .; then
36+
echo "::notice::commits found within last 7 days window, publish will execute"
37+
echo "should_run=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "::notice::no commits found within last 7 days window, publish will abort"
40+
echo "should_run=false" >> $GITHUB_OUTPUT
41+
fi
42+
fi
1843
44+
publish-snapshot:
45+
needs: [check-branch, check-updates]
46+
if: needs.check-updates.outputs.should_run == 'true'
1947
runs-on: ubuntu-latest
2048
steps:
2149
- name: Checkout

0 commit comments

Comments
 (0)