From b77d5bacea7f004153b2752a9cb17d26ae975cf9 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:17:52 -0500 Subject: Switch CI to use release script (#3242) --- .gitattributes | 1 - .github/workflows/release-files.yml | 32 ++++++++++++++++++++--------- .github/workflows/release.yml | 40 +++++++++++++++++-------------------- .github/workflows/tarball.yml | 2 +- bin/release | 2 +- 5 files changed, 43 insertions(+), 34 deletions(-) diff --git a/.gitattributes b/.gitattributes index 1d1ad38..38f1959 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,4 @@ * text=auto !eol -bin/bbrelease -text bin/genparser -text bin/switch_maint_mode -text c++/src/H5OcreatProp.cpp -text diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index 94065dc..3a77fe5 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -114,13 +114,19 @@ jobs: name: tgz-ubuntu-2204-binary path: ${{ github.workspace }} + - name: Store snapshot name + run: | + echo "${{ steps.get-file-base.outputs.FILE_BASE }}" > ./last-file.txt + - name: PreRelease tag - id: create_release + id: create_prerelease + if: ${{ (inputs.use_environ == 'snapshots') }} uses: softprops/action-gh-release@v1 with: tag_name: "${{ inputs.use_tag }}" prerelease: true files: | + last-file.txt ${{ 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 @@ -129,14 +135,22 @@ jobs: ${{ 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: Release tag + id: create_release + if: ${{ (inputs.use_environ == 'release') }} + uses: softprops/action-gh-release@v1 + with: + tag_name: "${{ inputs.use_tag }}" + prerelease: false + #body_path: ${{ github.workspace }}-CHANGELOG.txt + 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: List files for the space (Linux) run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0348c92..8297352 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,18 +18,14 @@ permissions: jobs: log-the-inputs: runs-on: ubuntu-latest + outputs: + rel_tag: ${{ steps.get-tag-name.outputs.RELEASE_TAG }} steps: - - run: | - echo "Tag: $TAG" - env: - TAG: ${{ inputs.use_tag }} - - - name: "Determine tag" - if: "${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'tag'" - run: | - "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" - "echo \"RELEASE_SHA=$(git rev-parse --short \"$GITHUB_SHA\")\" >> $GITHUB_ENV" - shell: "bash" + - name: Get tag name + id: get-tag-name + env: + TAG: ${{ inputs.use_tag }} + run: echo "RELEASE_TAG=$TAG" >> $GITHUB_OUTPUT # tarball.yml will be used for releases when pre-tag actions are implemented # call-workflow-tarball: @@ -42,11 +38,13 @@ jobs: create-files-ctest: needs: log-the-inputs runs-on: ubuntu-latest + outputs: + file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} steps: - name: Set file base name id: set-file-base run: | - FILE_NAME_BASE=$(echo "${{ needs.log-the-inputs.outputs.TAG }}") + FILE_NAME_BASE=$(echo "${{ needs.log-the-inputs.outputs.rel_tag }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash @@ -54,12 +52,12 @@ jobs: - name: Get Sources uses: actions/checkout@v3 with: - path: ${{ steps.set-file-base.outputs.FILE_BASE }} + path: hdfsrc - name: Zip Folder run: | - zip -r ${{ steps.get-file-base.outputs.FILE_BASE }}.zip ./${{ steps.get-file-base.outputs.FILE_BASE }} - tar -zcvf ${{ steps.get-file-base.outputs.FILE_BASE }}.tag.gz ./${{ steps.get-file-base.outputs.FILE_BASE }} + zip -r ${{ steps.set-file-base.outputs.FILE_BASE }}.zip ./hdfsrc + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz ./hdfsrc - name: List files in the repository run: | @@ -86,19 +84,17 @@ jobs: uses: ./.github/workflows/cmake-ctest.yml with: file_base: ${{ needs.create-files-ctest.outputs.file_base }} - use_tag: ${{ inputs.use_tag }} - use_environ: ${{ inputs.use_environ }} call-workflow-release: #needs: [call-workflow-tarball, call-workflow-ctest] - needs: [log-the-inputs, call-workflow-ctest] + needs: [log-the-inputs, create-files-ctest, call-workflow-ctest] permissions: contents: write # In order to allow tag creation uses: ./.github/workflows/release-files.yml with: file_base: ${{ needs.create-files-ctest.outputs.file_base }} - file_branch: ${{ needs.log-the-inputs.outputs.TAG }} - file_sha: ${{ needs.log-the-inputs.outputs.RELEASE_SHA }} - use_tag: ${{ inputs.use_tag }} - use_environ: ${{ inputs.use_environ }} + file_branch: ${{ needs.log-the-inputs.outputs.rel_tag }} + file_sha: ${{ needs.log-the-inputs.outputs.rel_tag }} + use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} + use_environ: release diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index d57f951..fd84f10 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -115,7 +115,7 @@ jobs: 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 + bin/release -d $GITHUB_WORKSPACE --branch ${{ needs.check_commits.outputs.branch_ref }} --revision gzip zip shell: bash - name: Create release file base name diff --git a/bin/release b/bin/release index b84bbff..1226d33 100755 --- a/bin/release +++ b/bin/release @@ -581,7 +581,7 @@ for comp in $methods; do ;; zip) test "$verbose" && echo " Creating zip ball..." 1>&2 - tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 + tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 (cd $DEST; sha256sum $HDF5_VERS.zip >> $SHA256) ;; cmake-zip) -- cgit v0.12