Replace all tabs with spaces

According to .editorconfig file
This commit is contained in:
Felix Kröner 2024-12-04 16:35:08 +01:00
parent 765e655aba
commit f4520558e6

View file

@ -23,22 +23,22 @@ export GNUPGHOME
setup_tea() { setup_tea() {
if ! test -f "$BIN_DIR"/tea ; then if ! test -f "$BIN_DIR"/tea ; then
ARCH=$(dpkg --print-architecture) ARCH=$(dpkg --print-architecture)
curl -sL https://dl.gitea.io/tea/$TEA_VERSION/tea-$TEA_VERSION-linux-"$ARCH" > "$BIN_DIR"/tea curl -sL https://dl.gitea.io/tea/$TEA_VERSION/tea-$TEA_VERSION-linux-"$ARCH" > "$BIN_DIR"/tea
chmod +x "$BIN_DIR"/tea chmod +x "$BIN_DIR"/tea
fi fi
} }
ensure_tag() { ensure_tag() {
if api GET repos/$REPO/tags/"$TAG" > "$TMP_DIR"/tag.json ; then if api GET repos/$REPO/tags/"$TAG" > "$TMP_DIR"/tag.json ; then
local sha=$(jq --raw-output .commit.sha < "$TMP_DIR"/tag.json) local sha=$(jq --raw-output .commit.sha < "$TMP_DIR"/tag.json)
if test "$sha" != "$SHA" ; then if test "$sha" != "$SHA" ; then
cat "$TMP_DIR"/tag.json cat "$TMP_DIR"/tag.json
echo "the tag SHA in the $REPO repository does not match the tag SHA that triggered the build: $SHA" echo "the tag SHA in the $REPO repository does not match the tag SHA that triggered the build: $SHA"
false false
fi fi
else else
api POST repos/$REPO/tags --data-raw '{"tag_name": "'"$TAG"'", "target": "'"$SHA"'"}' api POST repos/$REPO/tags --data-raw '{"tag_name": "'"$TAG"'", "target": "'"$SHA"'"}'
fi fi
} }
@ -85,26 +85,26 @@ maybe_use_release_note_assistant() {
sign_release() { sign_release() {
local passphrase local passphrase
if test -s "$GPG_PASSPHRASE"; then if test -s "$GPG_PASSPHRASE"; then
passphrase="--passphrase-file $GPG_PASSPHRASE" passphrase="--passphrase-file $GPG_PASSPHRASE"
fi fi
gpg --import --no-tty --pinentry-mode loopback "$passphrase" "$GPG_PRIVATE_KEY" gpg --import --no-tty --pinentry-mode loopback "$passphrase" "$GPG_PRIVATE_KEY"
for asset in "$RELEASE_DIR"/* ; do for asset in "$RELEASE_DIR"/* ; do
if [[ $asset =~ .sha256$ ]] ; then if [[ $asset =~ .sha256$ ]] ; then
continue continue
fi fi
gpg --armor --detach-sign --no-tty --pinentry-mode loopback "$passphrase" < "$asset" > "$asset".asc gpg --armor --detach-sign --no-tty --pinentry-mode loopback "$passphrase" < "$asset" > "$asset".asc
done done
} }
maybe_sign_release() { maybe_sign_release() {
if test -s "$GPG_PRIVATE_KEY"; then if test -s "$GPG_PRIVATE_KEY"; then
sign_release sign_release
fi fi
} }
maybe_override() { maybe_override() {
if test "$OVERRIDE" = "false"; then if test "$OVERRIDE" = "false"; then
return return
fi fi
api DELETE repos/$REPO/releases/tags/"$TAG" >& /dev/null || true api DELETE repos/$REPO/releases/tags/"$TAG" >& /dev/null || true
api DELETE repos/$REPO/tags/"$TAG" >& /dev/null || true api DELETE repos/$REPO/tags/"$TAG" >& /dev/null || true
@ -122,8 +122,8 @@ upload() {
setup_api() { setup_api() {
if ! which jq curl ; then if ! which jq curl ; then
apt-get -qq update apt-get -qq update
apt-get install -y -qq jq curl apt-get install -y -qq jq curl
fi fi
} }
@ -139,40 +139,40 @@ api() {
wait_release() { wait_release() {
local ready=false local ready=false
for i in $(seq $RETRY); do for i in $(seq $RETRY); do
if api GET repos/$REPO/releases/tags/"$TAG" | jq --raw-output .draft > "$TMP_DIR"/draft; then if api GET repos/$REPO/releases/tags/"$TAG" | jq --raw-output .draft > "$TMP_DIR"/draft; then
if test "$(cat "$TMP_DIR"/draft)" = "false"; then if test "$(cat "$TMP_DIR"/draft)" = "false"; then
ready=true ready=true
break break
fi fi
echo "release $TAG is still a draft" echo "release $TAG is still a draft"
else else
echo "release $TAG does not exist yet" echo "release $TAG does not exist yet"
fi fi
echo "waiting $DELAY seconds" echo "waiting $DELAY seconds"
sleep $DELAY sleep $DELAY
done done
if ! $ready ; then if ! $ready ; then
echo "no release for $TAG" echo "no release for $TAG"
return 1 return 1
fi fi
} }
download() { download() {
setup_api setup_api
( (
mkdir -p $RELEASE_DIR mkdir -p $RELEASE_DIR
cd $RELEASE_DIR cd $RELEASE_DIR
if [[ ${DOWNLOAD_LATEST} == "true" ]] ; then if [[ ${DOWNLOAD_LATEST} == "true" ]] ; then
echo "Downloading the latest release" echo "Downloading the latest release"
api GET repos/$REPO/releases/latest > "$TMP_DIR"/assets.json api GET repos/$REPO/releases/latest > "$TMP_DIR"/assets.json
elif [[ ${DOWNLOAD_LATEST} == "false" ]] ; then elif [[ ${DOWNLOAD_LATEST} == "false" ]] ; then
wait_release wait_release
echo "Downloading tagged release ${TAG}" echo "Downloading tagged release ${TAG}"
api GET repos/$REPO/releases/tags/"$TAG" > "$TMP_DIR"/assets.json api GET repos/$REPO/releases/tags/"$TAG" > "$TMP_DIR"/assets.json
fi fi
jq --raw-output '.assets[] | "\(.name) \(.browser_download_url)"' < "$TMP_DIR"/assets.json | while read name url ; do jq --raw-output '.assets[] | "\(.name) \(.browser_download_url)"' < "$TMP_DIR"/assets.json | while read name url ; do
curl --fail -H "Authorization: token $TOKEN" -o "$name" -L "$url" curl --fail -H "Authorization: token $TOKEN" -o "$name" -L "$url"
done done
) )
} }