From ed9791f1ce63e12348bba827ec5d090a6a4255c8 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 29 Jun 2023 15:40:27 -0500 Subject: Update actions for release option, fix branch for daily build (#3185) * Update actions for release option, fix branch for daily build * Scheduled workflows run on latest commit on the develop * Add snapshots location --- .github/workflows/daily-build.yml | 9 +- .github/workflows/hdfeos5.yml | 2 +- .github/workflows/release-files.yml | 151 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 173 ++++++++++-------------------------- .github/workflows/tarball.yml | 41 ++++++++- README.md | 2 +- bin/bbrelease | 3 - 7 files changed, 246 insertions(+), 135 deletions(-) create mode 100644 .github/workflows/release-files.yml diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index ec35e10..5633b3c 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -14,22 +14,29 @@ permissions: jobs: call-workflow-tarball: uses: ./.github/workflows/tarball.yml + with: + #use_tag: snapshot + use_environ: snapshots call-workflow-ctest: needs: call-workflow-tarball uses: ./.github/workflows/cmake-ctest.yml with: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + #use_tag: snapshot + #use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} call-workflow-release: needs: [call-workflow-tarball, call-workflow-ctest] permissions: contents: write # In order to allow tag creation - uses: ./.github/workflows/release.yml + uses: ./.github/workflows/release-files.yml with: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} file_branch: ${{ needs.call-workflow-tarball.outputs.file_branch }} file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }} + use_tag: snapshot + use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} diff --git a/.github/workflows/hdfeos5.yml b/.github/workflows/hdfeos5.yml index 04c92b9..fd2d011 100644 --- a/.github/workflows/hdfeos5.yml +++ b/.github/workflows/hdfeos5.yml @@ -1,4 +1,4 @@ -name: hdfeos5 +name: hdfeos5 dev on: workflow_dispatch: diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml new file mode 100644 index 0000000..94065dc --- /dev/null +++ b/.github/workflows/release-files.yml @@ -0,0 +1,151 @@ +name: hdf5 dev release-files + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + file_branch: + description: "The branch name for the source tarballs" + required: true + type: string + file_sha: + description: "The sha for the source tarballs" + required: true + type: string + +# Minimal permissions to be inherited by any job that doesn't declare its own permissions +permissions: + contents: read + +# Previous workflows must pass to get here so tag the commit that created the files +jobs: + create-tag: + runs-on: ubuntu-latest + permissions: + contents: write # In order to allow tag creation + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - run: | + git checkout ${{ inputs.file_sha }} + + - uses: rickstaa/action-create-tag@v1 + id: "tag_create" + with: + commit_sha: ${{ inputs.file_sha }} + tag: "${{ inputs.use_tag }}" + force_push_tag: true + message: "Latest snapshot" + if: ${{ inputs.use_environ == 'snapshots' }} + + # Print result using the action output. + - run: | + echo "Tag already present: ${{ steps.tag_create.outputs.tag_exists }}" + + PreRelease-getfiles: + runs-on: ubuntu-latest + needs: create-tag + environment: ${{ inputs.use_environ }} + permissions: + contents: write + steps: + - name: Get file base name + id: get-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by tarball script + - name: Get doxygen (Linux) + uses: actions/download-artifact@v3 + with: + name: docs-doxygen + path: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen + + - name: Zip Folder + run: zip -r ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ./${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen + + - name: Get tgz-tarball (Linux) + uses: actions/download-artifact@v3 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: Get zip-tarball (Windows) + uses: actions/download-artifact@v3 + with: + name: zip-tarball + path: ${{ github.workspace }} + + # Get files created by cmake-ctest script + - name: Get published binary (Windows) + uses: actions/download-artifact@v3 + with: + name: zip-vs2022-binary + path: ${{ github.workspace }} + + - name: Get published binary (MacOS) + uses: actions/download-artifact@v3 + with: + name: tgz-osx12-binary + path: ${{ github.workspace }} + + - name: Get published binary (Linux) + uses: actions/download-artifact@v3 + with: + name: tgz-ubuntu-2204-binary + path: ${{ github.workspace }} + + - name: PreRelease tag + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: "${{ inputs.use_tag }}" + prerelease: true + files: | + ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win_vs2022.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - name: Store Release url + run: | + echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url + +# - uses: actions/upload-artifact@v3 +# with: +# path: ./upload_url +# name: upload_url + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: dev-only-docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6bf9db8..3f9260e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,140 +1,63 @@ -name: hdf5 dev release +name: hdf5 dev release build -# Controls when the action will run. Triggers the workflow on a schedule +# Controls when the action will run. Triggers the workflow on a manual run on: - workflow_call: + workflow_dispatch: inputs: - file_base: - description: "The common base name of the source tarballs" - required: true - type: string - file_branch: - description: "The branch name for the source tarballs" - required: true + use_tag: + description: 'Release version tag' type: string - file_sha: - description: "The sha for the source tarballs" + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: choice required: true - type: string + default: snapshots + options: + - snapshots + - release -# Minimal permissions to be inherited by any job that doesn't declare its own permissions permissions: contents: read -# Previous workflows must pass to get here so tag the commit that created the files +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel. jobs: - create-tag: + log-the-inputs: runs-on: ubuntu-latest - permissions: - contents: write # In order to allow tag creation steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - run: | - git checkout ${{ inputs.file_sha }} - - - uses: rickstaa/action-create-tag@v1 - id: "tag_create" - with: - commit_sha: ${{ inputs.file_sha }} - tag: "snapshot" - force_push_tag: true - message: "Latest snapshot" - - # Print result using the action output. - - run: | - echo "Tag already present: ${{ steps.tag_create.outputs.tag_exists }}" - - PreRelease-getfiles: - runs-on: ubuntu-latest - needs: create-tag - environment: snapshots + echo "Tag: $TAG" + echo "Environment: $ENVIRONMENT" + env: + TAG: ${{ inputs.tag }} + ENVIRONMENT: ${{ inputs.environment }} + + call-workflow-tarball: + needs: log-the-inputs + uses: ./.github/workflows/tarball.yml + with: + use_tag: ${{ inputs.use_tag }} + use_environ: ${{ inputs.use_environ }} + + call-workflow-ctest: + needs: call-workflow-tarball + uses: ./.github/workflows/cmake-ctest.yml + with: + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + use_tag: ${{ inputs.use_tag }} + use_environ: ${{ inputs.use_environ }} + + call-workflow-release: + needs: [call-workflow-tarball, call-workflow-ctest] permissions: - contents: write - steps: - - name: Get file base name - id: get-file-base - run: | - FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - - # Get files created by tarball script - - name: Get doxygen (Linux) - uses: actions/download-artifact@v3 - with: - name: docs-doxygen - path: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen - - - name: Zip Folder - run: zip -r ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ./${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen - - - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@v3 - with: - name: tgz-tarball - path: ${{ github.workspace }} - - - name: Get zip-tarball (Windows) - uses: actions/download-artifact@v3 - with: - name: zip-tarball - path: ${{ github.workspace }} - - # Get files created by cmake-ctest script - - name: Get published binary (Windows) - uses: actions/download-artifact@v3 - with: - name: zip-vs2022-binary - path: ${{ github.workspace }} - - - name: Get published binary (MacOS) - uses: actions/download-artifact@v3 - with: - name: tgz-osx12-binary - path: ${{ github.workspace }} - - - name: Get published binary (Linux) - uses: actions/download-artifact@v3 - with: - name: tgz-ubuntu-2204-binary - path: ${{ github.workspace }} - - - name: PreRelease tag - id: create_release - uses: softprops/action-gh-release@v1 - with: - tag_name: "snapshot" - prerelease: true - files: | - ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}-win_vs2022.zip - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - - - name: Store Release url - run: | - echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url - -# - uses: actions/upload-artifact@v3 -# with: -# path: ./upload_url -# name: upload_url - - - name: List files for the space (Linux) - run: | - ls -l ${{ github.workspace }} - ls ${{ runner.workspace }} - - - name: dev-only-docs - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen + contents: write # In order to allow tag creation + uses: ./.github/workflows/release-files.yml + with: + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + file_branch: ${{ needs.call-workflow-tarball.outputs.file_branch }} + file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }} + use_tag: ${{ inputs.use_tag }} + use_environ: ${{ inputs.use_environ }} diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index 499f022..659592f 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -3,6 +3,17 @@ name: hdf5 dev tarball # Controls when the action will run. Triggers the workflow on a schedule on: workflow_call: + inputs: +# use_tag: +# description: 'Release version tag' +# type: string +# required: false +# default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots outputs: has_changes: description: "Whether there were changes the previous day" @@ -55,6 +66,7 @@ jobs: with: seconds: 86400 # One day in seconds branch: '${{ steps.get-branch-name.outputs.branch_ref }}' + if: ${{ inputs.use_environ == 'snapshots' }} - run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) in ${{ steps.get-branch-name.outputs.BRANCH_REF }} ✅!" if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }} @@ -65,7 +77,7 @@ jobs: name: Create a source tarball runs-on: ubuntu-latest needs: check_commits - if: ${{ needs.check_commits.outputs.has_changes == 'true' }} + if: ('${{ inputs.use_environ }}' == 'snapshots' && ${{ needs.check_commits.outputs.has_changes }} == 'true') || '${{ inputs.use_environ }}' == 'release' outputs: file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} steps: @@ -80,19 +92,40 @@ jobs: sudo apt update sudo apt install automake autoconf libtool libtool-bin gzip dos2unix + - name: Retrieve version + id: version + run: | + cd "$GITHUB_WORKSPACE/hdfsrc" + echo "TAG_VERSION=$(bin/h5vers)" >> $GITHUB_OUTPUT + - name: Set file base name id: set-file-base run: | - FILE_NAME_BASE=$(echo "hdf5-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}") + if [[ '${{ inputs.use_environ }}' == 'snapshots' && ${{ needs.check_commits.outputs.has_changes }} == 'true' ]] + then + FILE_NAME_BASE=$(echo "hdf5-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}") + else + FILE_NAME_BASE=$(echo "hdf5-${{ steps.version.outputs.TAG_VERSION }}") + fi echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + shell: bash - - name: Run release script - id: run-release-script + - name: Create snapshot file base name + id: create-file-base + if: ${{ inputs.use_environ }} == 'snapshots' && ${{ needs.check_commits.outputs.has_changes }} == 'true' run: | cd "$GITHUB_WORKSPACE/hdfsrc" bin/bbrelease -d $GITHUB_WORKSPACE --branch ${{ needs.check_commits.outputs.branch_ref }} --revision gzip zip shell: bash + - name: Create release file base name + id: create-rel-base + if: ${{ inputs.use_environ }} == 'release' + run: | + cd "$GITHUB_WORKSPACE/hdfsrc" + bin/release -d $GITHUB_WORKSPACE gzip zip cmake-tgz cmake-zip + shell: bash + - name: List files in the repository run: | ls -l ${{ github.workspace }} diff --git a/README.md b/README.md index 0b444cb..c670f65 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ SNAPSHOTS, PREVIOUS RELEASES AND SOURCE CODE -------------------------------------------- Periodically development code snapshots are provided at the following URL: - https://gamma.hdfgroup.org/ftp/pub/outgoing/hdf5/snapshots/ + https://github.com/HDFGroup/hdf5/releases/tag/snapshot Source packages for current and previous releases are located at: diff --git a/bin/bbrelease b/bin/bbrelease index c59e2e5..48253e0 100755 --- a/bin/bbrelease +++ b/bin/bbrelease @@ -35,9 +35,6 @@ Usage: $0 -d [-h] [--private] [--revision [--branch BRANCHNAME]] -h print the help page. --private Make a private release with today's date in version information. --revision Make a private release with the code revision number in version information. - This allows --branch to be used for the file name. - --branch BRANCHNAME This is to get the correct version of the branch name from the - repository. BRANCHNAME for v1.8 should be hdf5_1_8. This must be run at the top level of the source directory. The other command-line options are the names of the programs to use -- cgit v0.12