From 018ca4e37f52e13db5e72926ad2827460eec9cdd Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 25 May 2023 12:24:54 -0500 Subject: Develop release workflow (#3002) Implement (pre)release workflow for daily build --- .github/workflows/daily-build.yml | 12 +++- .github/workflows/release.yml | 115 ++++++++++++++++++++++++++++++++++++++ .github/workflows/tarball.yml | 6 ++ 3 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 04e52ac..265a6c3 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -6,9 +6,6 @@ on: schedule: - cron: "6 0 * * *" -permissions: - contents: read - # A workflow run is made up of one or more jobs that can run sequentially or # in parallel. jobs: @@ -22,3 +19,12 @@ jobs: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + call-workflow-release: + needs: [call-workflow-tarball, call-workflow-ctest] + uses: ./.github/workflows/release.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 }} + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ed085bf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,115 @@ +name: hdf5 dev release + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + 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 + type: string + file_sha: + description: "The sha for the source tarballs" + required: true + type: string + +# 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: "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 }}" + + getfiles: + runs-on: ubuntu-latest + steps: + - name: Set file base name + id: set-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 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 }} + + # Get files used by release script + + PreRelease: + runs-on: ubuntu-latest + needs: [create-tag, getfiles] + environment: snapshots + permissions: + contents: write + steps: + - name: Set file base name + id: get-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + - name: PreRelease tag + uses: softprops/action-gh-release@v1 + with: + tag_name: "snapshot" + prerelease: true + files: | + ${{ 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` diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index e68cb64..ae2992e 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -10,6 +10,12 @@ on: file_base: description: "The common base name of the source tarballs" value: ${{ jobs.create_tarball.outputs.file_base }} + file_branch: + description: "The branch used for the source tarballs" + value: ${{ jobs.check_commits.outputs.branch_ref }} + file_sha: + description: "The sha used for the source tarballs" + value: ${{ jobs.check_commits.outputs.branch_sha }} permissions: contents: read -- cgit v0.12