@@ -3,12 +3,6 @@ name: hdfview daily build
33# Triggers the workflow on a schedule or on demand
44on :
55 workflow_dispatch :
6- inputs :
7- use_ignore :
8- description : ' Ignore has_changes check'
9- type : string
10- required : false
11- default : check
126 schedule :
137 - cron : " 7 0 * * *"
148
@@ -17,14 +11,34 @@ permissions:
1711 packages : write
1812
1913jobs :
14+ check-for-changes :
15+ runs-on : ubuntu-latest
16+ outputs :
17+ has_changes : ${{ steps.check-new-commits.outputs.has-new-commits }}
18+ steps :
19+ - uses : actions/checkout@v4
20+
21+ - name : Check for changed source
22+ id : check-new-commits
23+ uses : adriangl/check-new-commits-action@v1
24+ with :
25+ seconds : 86400 # One day in seconds
26+
27+ - run : echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) ✅!"
28+ if : ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }}
29+
30+ - run : echo "No new commits in the last 24 hours."
31+ if : ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }}
32+
2033 get-base-names :
34+ needs : check-for-changes
35+ if : ${{ needs.check-for-changes.outputs.has_changes == 'true' }}
2136 runs-on : ubuntu-latest
2237 outputs :
2338 hdf4-name : ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }}
2439 hdf5-name : ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }}
2540 hdfview-name : ${{ steps.gethdfviewbase.outputs.HDFVIEW_NAME_BASE }}
2641 has-previous-build : ${{ steps.check-last-file.outputs.EXISTS }}
27- run-ignore : ${{ steps.getinputs.outputs.INPUTS_IGNORE }}
2842
2943 steps :
3044 - uses : actions/checkout@v4.1.7
@@ -81,18 +95,10 @@ jobs:
8195 echo "hdf4 base name is ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }}."
8296 echo "hdf5 base name is ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }}."
8397
84- - name : Read inputs
85- id : getinputs
86- run : |
87- echo "INPUTS_IGNORE=${{ inputs.use_ignore }}" >> $GITHUB_OUTPUT
88-
89- - run : echo "use_ignore is ${{ steps.getinputs.outputs.INPUTS_IGNORE }}."
90-
9198 call-workflow-tarball :
9299 needs : get-base-names
93100 uses : ./.github/workflows/tarball.yml
94101 with :
95- use_ignore : ${{ needs.get-base-names.outputs.run-ignore }}
96102 build_environment : snapshot
97103
98104 call-workflow-maven-build :
@@ -106,7 +112,6 @@ jobs:
106112 hdf5_release_tag : snapshot
107113 hdf5_artifact_basename : ${{ needs.get-base-names.outputs.hdf5-name }}
108114 build_environment : snapshot
109- if : ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-base-names.outputs.run-ignore == 'ignore')) }}
110115
111116 call-workflow-release :
112117 needs : [get-base-names, call-workflow-tarball, call-workflow-maven-build]
@@ -119,13 +124,11 @@ jobs:
119124 file_sha : ${{ needs.call-workflow-tarball.outputs.file_sha }}
120125 release_version_tag : v99.99.99
121126 build_environment : snapshot
122- if : ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-base-names.outputs.run-ignore == 'ignore')) }}
123127
124128 # Remove old snapshot artifacts from the GitHub release to prevent accumulation
125129 # Only runs if:
126130 # 1. There was a previous build (last-file.txt exists)
127131 # 2. The new build has a different base name (commit SHA changed)
128- # 3. The build succeeded or ignore flag is set
129132 call-workflow-remove :
130133 needs : [get-base-names, call-workflow-tarball, call-workflow-maven-build, call-workflow-release]
131134 permissions :
@@ -135,5 +138,5 @@ jobs:
135138 artifact_basename : ${{ needs.get-base-names.outputs.hdfview-name }}
136139 release_version_tag : v99.99.99
137140 build_environment : snapshot
138- if : ${{ needs.get-base-names.outputs.has-previous-build == 'true' && ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-base-names.outputs.run-ignore == 'ignore')) && ( needs.get-base-names.outputs.hdfview-name != needs.call-workflow-tarball.outputs.artifact_basename) }}
141+ if : ${{ needs.get-base-names.outputs.has-previous-build == 'true' && (needs.get-base-names.outputs.hdfview-name != needs.call-workflow-tarball.outputs.artifact_basename) }}
139142
0 commit comments