hdfview daily build #1059
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: hdfview daily build | |
| # Triggers the workflow on a schedule or on demand | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "7 0 * * *" | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| check-for-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has_changes: ${{ steps.check-new-commits.outputs.has-new-commits }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for changed source | |
| id: check-new-commits | |
| uses: adriangl/check-new-commits-action@v1 | |
| with: | |
| seconds: 86400 # One day in seconds | |
| - run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) ✅!" | |
| if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }} | |
| - run: echo "No new commits in the last 24 hours." | |
| if: ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }} | |
| get-base-names: | |
| needs: check-for-changes | |
| if: ${{ needs.check-for-changes.outputs.has_changes == 'true' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| hdf4-name: ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }} | |
| hdf5-name: ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }} | |
| hdfview-name: ${{ steps.gethdfviewbase.outputs.HDFVIEW_NAME_BASE }} | |
| has-previous-build: ${{ steps.check-last-file.outputs.EXISTS }} | |
| steps: | |
| - uses: actions/checkout@v4.1.7 | |
| - name: Get hdfview release base name | |
| uses: dsaltares/fetch-gh-release-asset@master | |
| with: | |
| version: 'tags/HDFView-99.99.99' | |
| file: 'last-file.txt' | |
| continue-on-error: true | |
| - name: Check if last-file.txt exists | |
| id: check-last-file | |
| run: | | |
| if [ -f last-file.txt ]; then | |
| echo "EXISTS=true" >> $GITHUB_OUTPUT | |
| echo "last-file.txt exists" | |
| else | |
| echo "EXISTS=false" >> $GITHUB_OUTPUT | |
| echo "last-file.txt does not exist (first build or fetch failed)" | |
| fi | |
| - name: Read base-name file | |
| id: gethdfviewbase | |
| if: steps.check-last-file.outputs.EXISTS == 'true' | |
| run: echo "HDFVIEW_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT | |
| - run: echo "hdfview base name is ${{ steps.gethdfviewbase.outputs.HDFVIEW_NAME_BASE }}." | |
| if: steps.check-last-file.outputs.EXISTS == 'true' | |
| - name: Get hdf4 release base name | |
| uses: dsaltares/fetch-gh-release-asset@master | |
| with: | |
| repo: 'HDFGroup/hdf4' | |
| version: 'tags/snapshot' | |
| file: 'last-file.txt' | |
| - name: Read base-name file | |
| id: gethdf4base | |
| run: echo "HDF4_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT | |
| - name: Get hdf5 release base name | |
| uses: dsaltares/fetch-gh-release-asset@master | |
| with: | |
| repo: 'HDFGroup/hdf5' | |
| version: 'tags/snapshot' | |
| file: 'last-file.txt' | |
| - name: Read base-name file | |
| id: gethdf5base | |
| run: echo "HDF5_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT | |
| - run: | | |
| echo "hdf4 base name is ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }}." | |
| echo "hdf5 base name is ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }}." | |
| call-workflow-tarball: | |
| needs: get-base-names | |
| uses: ./.github/workflows/tarball.yml | |
| with: | |
| build_environment: snapshot | |
| call-workflow-maven-build: | |
| needs: [get-base-names, call-workflow-tarball] | |
| uses: ./.github/workflows/maven-build.yml | |
| secrets: inherit | |
| with: | |
| artifact_basename: ${{ needs.call-workflow-tarball.outputs.artifact_basename }} | |
| hdf4_release_tag: snapshot | |
| hdf4_artifact_basename: ${{ needs.get-base-names.outputs.hdf4-name }} | |
| hdf5_release_tag: snapshot | |
| hdf5_artifact_basename: ${{ needs.get-base-names.outputs.hdf5-name }} | |
| build_environment: snapshot | |
| call-workflow-release: | |
| needs: [get-base-names, call-workflow-tarball, call-workflow-maven-build] | |
| permissions: | |
| contents: write # In order to allow tag creation | |
| uses: ./.github/workflows/release-files.yml | |
| with: | |
| artifact_basename: ${{ needs.call-workflow-tarball.outputs.artifact_basename }} | |
| file_branch: ${{ needs.call-workflow-tarball.outputs.file_branch }} | |
| file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }} | |
| release_version_tag: v99.99.99 | |
| build_environment: snapshot | |
| # Remove old snapshot artifacts from the GitHub release to prevent accumulation | |
| # Only runs if: | |
| # 1. There was a previous build (last-file.txt exists) | |
| # 2. The new build has a different base name (commit SHA changed) | |
| call-workflow-remove: | |
| needs: [get-base-names, call-workflow-tarball, call-workflow-maven-build, call-workflow-release] | |
| permissions: | |
| contents: write # In order to allow file deletion | |
| uses: ./.github/workflows/remove-old-artifacts.yml | |
| with: | |
| artifact_basename: ${{ needs.get-base-names.outputs.hdfview-name }} | |
| release_version_tag: v99.99.99 | |
| build_environment: snapshot | |
| if: ${{ needs.get-base-names.outputs.has-previous-build == 'true' && (needs.get-base-names.outputs.hdfview-name != needs.call-workflow-tarball.outputs.artifact_basename) }} | |