Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 07:57:44

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 
0045 RELEASE_TARGET=${RELEASE_TARGET:-$(git rev-parse HEAD)}
0046 
0047 # Build and verify the source archive before anything is pushed, so that a
0048 # problem with it leaves no bumped commit and no release behind. Building it
0049 # locally rather than downloading it from GitHub is what makes that ordering
0050 # possible, since there is nothing to download until the commit is pushed.
0051 #
0052 # This archive is not the one GitHub generates for the tag: it additionally
0053 # carries the generated code in `prebuilt-codegen/`, which lets a build from it
0054 # skip the code generators and the downloads they need.
0055 archive="acts-${version}.tar.gz"
0056 archive_prefix="acts-${version#v}"
0057 run uv run --no-project "$SCRIPT_DIR/pregenerate_codegen.py" \
0058   --output prebuilt-codegen
0059 run "$SCRIPT_DIR/make_source_archive.sh" \
0060   --output "$archive" \
0061   --prebuilt prebuilt-codegen \
0062   --revision "$RELEASE_TARGET" \
0063   --prefix "$archive_prefix"
0064 
0065 # Check the archive the way a consumer sees it: unpacked, with nothing pointing
0066 # at the generated code, and with any fall back to running a generator fatal.
0067 rm -rf release-verify
0068 mkdir release-verify
0069 run tar xzf "$archive" -C release-verify
0070 run cmake -S "release-verify/${archive_prefix}/CI/codegen_prebuilt_check" \
0071   -B release-verify/build
0072 run cmake --build release-verify/build
0073 rm -rf release-verify prebuilt-codegen
0074 
0075 CI=${CI:-}
0076 if [ -n "$CI" ]; then
0077   run git push
0078 fi
0079 
0080 run git cliff --tag "$version" --latest --unreleased -o release.md
0081 
0082 set +e
0083 ! gh release view "$version" > /dev/null 2>&1
0084 release_exists=$?
0085 set -e
0086 if [[ $release_exists == 1 ]]; then
0087   echo "Release $version exists"
0088   run gh release edit $version \
0089     --notes-file release.md \
0090     --target $RELEASE_TARGET \
0091     --draft
0092 else
0093   echo "Release $version does not exist"
0094   run gh release create $version \
0095     --title "$version" \
0096     --notes-file release.md \
0097     --target $RELEASE_TARGET \
0098     --draft
0099 fi
0100 
0101 run gh release upload "${version}" "acts-${version}.tar.gz" \
0102   --clobber