2023-04-30 01:36:17 +08:00
|
|
|
name: hdf5 dev tarball
|
|
|
|
|
|
|
|
# Controls when the action will run. Triggers the workflow on a schedule
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2023-06-30 04:40:27 +08:00
|
|
|
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
|
2023-04-30 01:36:17 +08:00
|
|
|
outputs:
|
|
|
|
has_changes:
|
|
|
|
description: "Whether there were changes the previous day"
|
|
|
|
value: ${{ jobs.check_commits.outputs.has_changes }}
|
|
|
|
file_base:
|
|
|
|
description: "The common base name of the source tarballs"
|
|
|
|
value: ${{ jobs.create_tarball.outputs.file_base }}
|
2023-05-26 01:24:54 +08:00
|
|
|
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 }}
|
2023-04-30 01:36:17 +08:00
|
|
|
|
2023-05-19 05:08:10 +08:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-04-30 01:36:17 +08:00
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or
|
|
|
|
# in parallel
|
|
|
|
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:
|
|
|
|
- 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@v1
|
|
|
|
with:
|
|
|
|
seconds: 86400 # One day in seconds
|
|
|
|
branch: '${{ steps.get-branch-name.outputs.branch_ref }}'
|
2023-06-30 04:40:27 +08:00
|
|
|
if: ${{ inputs.use_environ == 'snapshots' }}
|
2023-04-30 01:36:17 +08:00
|
|
|
|
|
|
|
- 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
|
2023-06-30 21:06:25 +08:00
|
|
|
if: ${{ ((inputs.use_environ == 'snapshots') && (needs.check_commits.outputs.has_changes == 'true')) || (inputs.use_environ == 'release') }}
|
2023-04-30 01:36:17 +08:00
|
|
|
outputs:
|
|
|
|
file_base: ${{ steps.set-file-base.outputs.FILE_BASE }}
|
|
|
|
steps:
|
|
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
|
|
- name: Get Sources
|
2023-12-14 04:02:24 +08:00
|
|
|
uses: actions/checkout@v4.1.1
|
2023-04-30 01:36:17 +08:00
|
|
|
with:
|
|
|
|
path: hdfsrc
|
|
|
|
|
|
|
|
- name: Install Autotools Dependencies (Linux, serial)
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install automake autoconf libtool libtool-bin gzip dos2unix
|
|
|
|
|
2023-06-30 04:40:27 +08:00
|
|
|
- name: Retrieve version
|
|
|
|
id: version
|
|
|
|
run: |
|
|
|
|
cd "$GITHUB_WORKSPACE/hdfsrc"
|
|
|
|
echo "TAG_VERSION=$(bin/h5vers)" >> $GITHUB_OUTPUT
|
|
|
|
|
2023-04-30 01:36:17 +08:00
|
|
|
- name: Set file base name
|
|
|
|
id: set-file-base
|
|
|
|
run: |
|
2023-06-30 21:06:25 +08:00
|
|
|
if [[ '${{ inputs.use_environ }}' == 'snapshots' && '${{ needs.check_commits.outputs.has_changes }}' == 'true' ]]
|
2023-06-30 04:40:27 +08:00
|
|
|
then
|
2023-08-16 21:14:21 +08:00
|
|
|
FILE_NAME_BASE=$(echo "hdf5-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}")
|
2023-06-30 04:40:27 +08:00
|
|
|
else
|
2023-08-16 21:14:21 +08:00
|
|
|
FILE_NAME_BASE=$(echo "hdf5-${{ steps.version.outputs.TAG_VERSION }}")
|
2023-06-30 04:40:27 +08:00
|
|
|
fi
|
2023-04-30 01:36:17 +08:00
|
|
|
echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT
|
2023-06-30 04:40:27 +08:00
|
|
|
shell: bash
|
2023-04-30 01:36:17 +08:00
|
|
|
|
2023-06-30 04:40:27 +08:00
|
|
|
- name: Create snapshot file base name
|
|
|
|
id: create-file-base
|
2023-06-30 21:06:25 +08:00
|
|
|
if: ${{ (inputs.use_environ == 'snapshots') && (needs.check_commits.outputs.has_changes == 'true') }}
|
2023-04-30 01:36:17 +08:00
|
|
|
run: |
|
|
|
|
cd "$GITHUB_WORKSPACE/hdfsrc"
|
2023-07-14 01:17:52 +08:00
|
|
|
bin/release -d $GITHUB_WORKSPACE --branch ${{ needs.check_commits.outputs.branch_ref }} --revision gzip zip
|
2023-04-30 01:36:17 +08:00
|
|
|
shell: bash
|
|
|
|
|
2023-06-30 04:40:27 +08:00
|
|
|
- name: Create release file base name
|
|
|
|
id: create-rel-base
|
2023-06-30 21:06:25 +08:00
|
|
|
if: ${{ (inputs.use_environ == 'release') }}
|
2023-06-30 04:40:27 +08:00
|
|
|
run: |
|
|
|
|
cd "$GITHUB_WORKSPACE/hdfsrc"
|
|
|
|
bin/release -d $GITHUB_WORKSPACE gzip zip cmake-tgz cmake-zip
|
|
|
|
shell: bash
|
|
|
|
|
2023-04-30 01:36:17 +08:00
|
|
|
- name: List files in the repository
|
|
|
|
run: |
|
2023-06-17 02:34:24 +08:00
|
|
|
ls -l ${{ github.workspace }}
|
2023-04-30 01:36:17 +08:00
|
|
|
ls $GITHUB_WORKSPACE
|
|
|
|
|
|
|
|
# Save files created by release script
|
|
|
|
- name: Save tgz-tarball
|
2024-01-08 22:06:40 +08:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-30 01:36:17 +08:00
|
|
|
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
|
2024-01-08 22:06:40 +08:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-30 01:36:17 +08:00
|
|
|
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`
|