mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Update version to 2.1 and derive version information from H5public.h, removing h5vers script and updating CMake and Java configurations. Versioning: Update version to 2.1 in H5public.h. Derive version strings in H5public.h using macros. CMake: Extract version from H5public.h in HDF5config.cmake and HDF5AsSubdirMacros.cmake. Configure README.md and CHANGELOG.md using CMakeLists.txt. Java: Generate H5Version.java from H5public.h for version consistency. Update H5.java to use H5Version for version constants. Removals: Delete bin/h5vers script, previously used for version management.
215 lines
8.5 KiB
YAML
215 lines
8.5 KiB
YAML
name: hdf5 dev tarball
|
|
|
|
# Triggers the workflow on a call from another workflow
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
use_ignore:
|
|
description: 'Ignore has_changes check'
|
|
type: string
|
|
required: false
|
|
default: check
|
|
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"
|
|
value: ${{ jobs.check_commits.outputs.has_changes }}
|
|
source_base:
|
|
description: "The common base name of the source tarballs"
|
|
value: ${{ jobs.create_tarball.outputs.source_base }}
|
|
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
|
|
|
|
jobs:
|
|
check_commits:
|
|
name: Check for recent commits
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
has_changes: ${{ steps.check-new-commits.outputs.has-new-commits }}
|
|
branch_ref: ${{ steps.get-branch-name.outputs.BRANCH_REF }}
|
|
branch_sha: ${{ steps.get-branch-sha.outputs.BRANCH_SHA }}
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
|
|
- name: Get branch name
|
|
id: get-branch-name
|
|
env:
|
|
GITHUB_REF: ${{ github.ref }}
|
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
|
#run: echo "${{ env.GITHUB_REF_NAME }} | grep -P '[0-9]+/merge' &> /dev/null && BRANCH_REF=${{ env.GITHUB_HEAD_REF }} || BRANCH_REF=${{ env.GITHUB_REF_NAME }}" >> $GITHUB_OUTPUT
|
|
run: echo "BRANCH_REF=${{ env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get branch sha
|
|
id: get-branch-sha
|
|
env:
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
GITHUB_WF_SHA: ${{ github.workflow_sha }}
|
|
run: |
|
|
SHORT_SHA=$(echo "${{ env.GITHUB_WF_SHA }}" | cut -c1-7)
|
|
echo "BRANCH_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check for changed source
|
|
id: check-new-commits
|
|
uses: adriangl/check-new-commits-action@e6471f4fda990ebdb3bf44726371e1ad45ac4d37 # v1
|
|
with:
|
|
seconds: 86400 # One day in seconds
|
|
branch: '${{ steps.get-branch-name.outputs.branch_ref }}'
|
|
if: ${{ (inputs.use_environ == 'snapshots' && inputs.use_ignore == 'check') }}
|
|
|
|
- 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' }}
|
|
|
|
- run: echo "Short commit sha is ${{ steps.get-branch-sha.outputs.BRANCH_SHA }}!"
|
|
|
|
create_tarball:
|
|
name: Create a source tarball
|
|
runs-on: ubuntu-latest
|
|
needs: check_commits
|
|
if: ${{ ((inputs.use_environ == 'snapshots') && ((needs.check_commits.outputs.has_changes == 'true') || (inputs.use_ignore == 'ignore'))) || (inputs.use_environ == 'release') }}
|
|
outputs:
|
|
file_base: ${{ steps.set-file-base.outputs.FILE_BASE }}
|
|
source_base: ${{ steps.version.outputs.SOURCE_TAG }}
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- name: Get Sources
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
with:
|
|
path: hdfsrc
|
|
ref: '${{needs.check_commits.outputs.branch_ref }}'
|
|
|
|
- name: Install Linux Dependencies (Linux, serial)
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install gzip dos2unix
|
|
|
|
- name: Retrieve version
|
|
id: version
|
|
run: |
|
|
cd "$GITHUB_WORKSPACE/hdfsrc"
|
|
major=$(grep '^#define H5_VERS_MAJOR' src/H5public.h | awk '{print $3}')
|
|
minor=$(grep '^#define H5_VERS_MINOR' src/H5public.h | awk '{print $3}')
|
|
release=$(grep '^#define H5_VERS_RELEASE' src/H5public.h | awk '{print $3}')
|
|
subrelease=$(grep '^#define H5_VERS_SUBRELEASE' src/H5public.h | cut -d'"' -f2)
|
|
echo "SOURCE_TAG=${major}.${minor}.${release}${subrelease}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set file base name
|
|
id: set-file-base
|
|
run: |
|
|
if [[ '${{ inputs.use_environ }}' == 'snapshots' ]]
|
|
then
|
|
FILE_NAME_BASE=$(echo "hdf5-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}")
|
|
else
|
|
if [[ '${{ inputs.use_tag }}' == 'snapshot' ]]
|
|
then
|
|
FILE_NAME_BASE=$(echo "snapshot")
|
|
else
|
|
FILE_NAME_BASE=$(echo "hdf5-${{ steps.version.outputs.SOURCE_TAG }}")
|
|
fi
|
|
fi
|
|
echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Create snapshot file base name
|
|
id: create-file-base
|
|
if: ${{ (inputs.use_environ == 'snapshots') }}
|
|
run: |
|
|
cd "$GITHUB_WORKSPACE/hdfsrc"
|
|
bin/release -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
|
|
shell: bash
|
|
|
|
- name: Copy the release file source to a non-versioned file name
|
|
id: cp-to-non-versioned
|
|
if: ${{ (inputs.use_environ == 'release') }}
|
|
run: |
|
|
cp hdf5-${{ steps.version.outputs.SOURCE_TAG }}.tar.gz hdf5.tar.gz
|
|
cp hdf5-${{ steps.version.outputs.SOURCE_TAG }}.zip hdf5.zip
|
|
shell: bash
|
|
|
|
- name: Rename release file base name
|
|
id: ren-basename
|
|
if: ${{ (inputs.use_environ == 'release') && (inputs.use_tag == 'snapshot') }}
|
|
run: |
|
|
mv hdf5-${{ steps.version.outputs.SOURCE_TAG }}.tar.gz ${{ inputs.use_tag }}.tar.gz
|
|
mv hdf5-${{ steps.version.outputs.SOURCE_TAG }}.zip ${{ inputs.use_tag }}.zip
|
|
shell: bash
|
|
|
|
- name: List files in the repository
|
|
run: |
|
|
ls -l ${{ github.workspace }}
|
|
ls $GITHUB_WORKSPACE
|
|
|
|
# Save files created by release script
|
|
- name: Save tgz-tarball
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v5
|
|
with:
|
|
name: tgz-tarball
|
|
path: ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
- name: Save zip-tarball
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v5
|
|
with:
|
|
name: zip-tarball
|
|
path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
- name: Save tgz-tarball-nover
|
|
if: ${{ (inputs.use_environ == 'release') }}
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v5
|
|
with:
|
|
name: tgz-tarball-nover
|
|
path: hdf5.tar.gz
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
- name: Save zip-tarball-nover
|
|
if: ${{ (inputs.use_environ == 'release') }}
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v5
|
|
with:
|
|
name: zip-tarball-nover
|
|
path: hdf5.zip
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
- name: Create description for release/snapshot from "Executive Summary" section of CHANGELOG.md
|
|
run: |
|
|
sed -n '/^# .* Executive Summary: HDF5 Version .*/,/^# .* Breaking Changes/p' ./hdfsrc/release_docs/CHANGELOG.md | sed '$d' > description.txt
|
|
|
|
- name: List files in the repository
|
|
run: |
|
|
ls -l ${{ github.workspace }}
|
|
ls $GITHUB_WORKSPACE
|
|
|
|
- name: Upload description.txt
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v5
|
|
with:
|
|
name: description.txt
|
|
path: ./description.txt
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|