Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:01:20

0001 #!/bin/bash
0002 set -e
0003 set -u
0004 
0005 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
0006 export GIT_CLIFF_CONFIG=$SCRIPT_DIR/cliff.toml
0007 
0008 # helper function to selectively print and run commands without a subshell
0009 function run() {
0010     set -x
0011     "$@"
0012     # save exit code
0013     { rec=$?; } 2> /dev/null
0014     { set +x;   } 2> /dev/null
0015     # restore exit code
0016     (exit $rec)
0017 }
0018 
0019 export run
0020 
0021 if [ -z "${version:-}" ]; then
0022   version=$(git cliff --bumped-version)
0023 fi
0024 echo "Bumped version will be: $version"
0025 
0026 zenodo=$(cat .zenodo.json)
0027 echo "$zenodo" \
0028   | jq --arg version "$version" '.version = $version' \
0029   | jq --arg version "$version" '.title = "acts-project/acts: \($version)"' \
0030   > .zenodo.json
0031 echo "- Updated .zenodo.json"
0032 
0033 citation=$(cat CITATION.cff)
0034 echo "$citation" \
0035   | sed "s/^version: .*/version: $version/" \
0036   > CITATION.cff
0037 echo "- Updated CITATION.cff"
0038 
0039 echo "$version" | sed 's/^v//g' > version_number
0040 echo "- Updated version_bumber"
0041 
0042 run git add .zenodo.json CITATION.cff version_number
0043 run git commit -n -m"Bump version to $version"
0044 CI=${CI:-}
0045 if [ -n "$CI" ]; then
0046   run git push
0047 fi
0048 
0049 run git cliff --tag "$version" --latest --unreleased -o release.md
0050 
0051 RELEASE_TARGET=${RELEASE_TARGET:-$(git rev-parse HEAD)}
0052 
0053 repo_name=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
0054 
0055 run curl "https://github.com/${repo_name}/archive/${RELEASE_TARGET}.tar.gz" -L -o "acts-${version}.tar.gz"
0056 
0057 set +e
0058 ! gh release view "$version" > /dev/null 2>&1
0059 release_exists=$?
0060 set -e
0061 if [[ $release_exists == 1 ]]; then
0062   echo "Release $version exists"
0063   run gh release edit $version \
0064     --notes-file release.md \
0065     --target $RELEASE_TARGET \
0066     --draft
0067 else
0068   echo "Release $version does not exist"
0069   run gh release create $version \
0070     --title "$version" \
0071     --notes-file release.md \
0072     --target $RELEASE_TARGET \
0073     --draft
0074 fi
0075 
0076 run gh release upload "${version}" "acts-${version}.tar.gz" \
0077   --clobber