Skip to content

Commit

Permalink
shellcheck fixes
Browse files Browse the repository at this point in the history
Conditionalize use of signify-openbsd
Closes: #748
Signed-off-by: Rick Farina (Zero_Chaos) <[email protected]>
  • Loading branch information
ZeroChaos- committed Jan 30, 2024
1 parent d605d9a commit 58c784b
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions scripts/tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#
# SPDX-License-Identifier: LGPL-3.0-or-later

setopt ERR_EXIT #exit on error
set -e
set -u

#Project name
project=volk
#What to prefix in release tags in front of the version number
Expand Down Expand Up @@ -55,22 +57,22 @@ shortlog="
## [${version}] - $(date +'%Y-%m-%d')
$(git shortlog -e ${last_release}..HEAD)
$(git shortlog -e "${last_release}"..HEAD)
"
echo "${shortlog}"

echo "${shortlog}" > ${deltafile}
echo "${shortlog}" > "${deltafile}"

${EDITOR} ${deltafile}
${EDITOR} "${deltafile}"

echo "$(cat ${deltafile})" >> ${changelog}
echo "${releaseprefix}${version}" > ${lastreleasefile}
cat "${deltafile}" >> "${changelog}"
echo "${releaseprefix}${version}" > "${lastreleasefile}"

# 3. Commit changelog
git commit -m "Release ${version}" "${changelog}" "${lastreleasefile}" CMakeLists.txt

# 4. prepare tag
cat "${deltafile}" > ${annotationfile}
cat "${deltafile}" > "${annotationfile}"
# Append the HEAD commit hash to the annotation
echo "git-describes-hash: $(git rev-parse --verify HEAD)" >> "${annotationfile}"

Expand All @@ -93,11 +95,11 @@ outfile="${tempdir}/${tarprefix}.tar"
git archive "--output=${outfile}" "--prefix=${tarprefix}/" HEAD
# Append submodule archives
git submodule foreach --recursive "git archive --output ${tempdir}/${tarprefix}-sub-\${sha1}.tar --prefix=${tarprefix}/\${sm_path}/ HEAD"
if [[ $(ls ${tempdir}/${tarprefix}-sub*.tar | wc -l) != 0 ]]; then
if [[ $(ls "${tempdir}/${tarprefix}"-sub*.tar | wc -l) != 0 ]]; then
# combine all archives into one tar
tar --concatenate --file ${outfile} ${tempdir}/${tarprefix}-sub*.tar
tar --concatenate --file "${outfile}" "${tempdir}/${tarprefix}"-sub*.tar
fi
echo "Created tape archive '${outfile}' of size $(du -h ${outfile})."
echo "Created tape archive ${outfile} of size $(du -h "${outfile}")."

# 6. compress
echo "compressing:"
Expand All @@ -113,15 +115,17 @@ echo "…compressed."
# 7. sign

# 7.1 with openbsd-signify
echo "signing file list…"
filelist="${tempdir}/${version}.sha256"
pushd "${tempdir}"
sha256sum --tag *.tar.* > "${filelist}"
signify-openbsd -S -e -s "${seckey}" -m "${filelist}"
echo "…signed. Check with 'signify -C -p \"${pubkey}\" -x \"${filelist}\"'."
signify-openbsd -C -p "${pubkey}" -x "${filelist}.sig"
popd
echo "checked."
if type 'signify-openbsd' > /dev/null; then
echo "signing file list…"
filelist="${tempdir}/${version}.sha256"
pushd "${tempdir}" || exit 1
sha256sum --tag -- *.tar.* > "${filelist}"
signify-openbsd -S -e -s "${seckey}" -m "${filelist}"
echo "…signed. Check with 'signify -C -p \"${pubkey}\" -x \"${filelist}\"'."
signify-openbsd -C -p "${pubkey}" -x "${filelist}.sig"
popd
echo "checked."
fi

# 7.2 with GPG
echo "signing tarballs with GPG ..."
Expand All @@ -143,4 +147,3 @@ echo "Release tag: 'git push ${remote} v${releaseprefix}${version}'"
# git push "${remote}" HEAD
# git push "${remote}" "v${releaseprefix}${version}"
#fi

0 comments on commit 58c784b

Please sign in to comment.