1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pleroma_ynh.git synced 2024-09-03 20:15:59 +02:00

Fix updater

This commit is contained in:
yalh76 2022-10-14 04:40:55 +02:00
parent 45d59f85c5
commit 34a985aef8
4 changed files with 34 additions and 35 deletions

View file

@ -50,9 +50,6 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
exit 0 exit 0
fi fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#================================================= #=================================================
# UPDATE SOURCE FILES # UPDATE SOURCE FILES
#================================================= #=================================================
@ -61,29 +58,31 @@ echo "${#assets[@]} available asset(s)"
architectures=("amd64" "arm64" "arm") architectures=("amd64" "arm64" "arm")
for arch in ${architectures[@]}; do for arch in ${architectures[@]}; do
echo "Processing $arch release" echo "Processing $arch release"
artifact=$(curl --silent "https://git.pleroma.social/api/v4/projects/2/pipelines/$pipeline_id/jobs" | jq -r '[ .[] | select((.status=="success") and (.stage=="release") and (.name=="'$arch'")).id|tostring ] | join(" ") ' | tr -d "'") job_url=$(curl --silent "https://git.pleroma.social/api/v4/projects/2/pipelines/$pipeline_id/jobs" | jq -r '.[] | select((.status=="success") and (.stage=="release") and (.name=="'$arch'")) | .web_url')
if [ ! -z "$artifact" ]; then if [ ! -z "$job_url" ]; then
# Create the temporary directory asset_url="$job_url/artifacts/download?file_type=archive"
tempdir="$(mktemp -d)"
# Download sources and calculate checksum # Create the temporary directory
filename=${asset_url##*/} tempdir="$(mktemp -d)"
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory # Download sources and calculate checksum
rm -rf $tempdir filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
if [ $arch == "arm" ]; then # Delete temporary directory
rm -rf $tempdir
if [ $arch == "arm" ]; then
arch="armhf" arch="armhf"
fi fi
# Rewrite source file # Rewrite source file
cat <<EOT > conf/$arch.src cat <<EOT > conf/$arch.src
SOURCE_URL=$asset_url SOURCE_URL=$asset_url
SOURCE_SUM=$checksum SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
@ -91,12 +90,12 @@ SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=
EOT EOT
echo "... conf/$arch.src updated" echo "... conf/$arch.src updated"
else else
echo "... artifact ignored" echo "... artifact ignored"
echo "::warning ::Artifact for $arch was not updated" echo "::warning ::Artifact for $arch was not updated"
fi fi
done done

View file

@ -1,5 +1,5 @@
SOURCE_URL= SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/220705/artifacts/download?file_type=archive
SOURCE_SUM= SOURCE_SUM=8b4e2ab17362c7b0ed3ca685e19d578ad842ac00cde2db7d8c54dfd5a4e05891
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,5 +1,5 @@
SOURCE_URL= SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/220709/artifacts/download?file_type=archive
SOURCE_SUM= SOURCE_SUM=e432310df95ae4d915a02082252df0346ca7e112ffa4484b6a05075778c71338
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,5 +1,5 @@
SOURCE_URL= SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/220707/artifacts/download?file_type=archive
SOURCE_SUM= SOURCE_SUM=c31dd8bb62728887cfe5488ef5818dc5e57e90f6443fbcfd501ea12044d0a94c
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true