ci: fix uploads

This commit is contained in:
Yaksh Bariya 2022-04-18 21:53:42 +05:30
parent b54abb6732
commit d41ad97af5
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
1 changed files with 14 additions and 28 deletions

View File

@ -188,29 +188,25 @@ jobs:
run: |
test -d termux-packages/output && mv termux-packages/output/* ./output/
rm -rf debs
for repo in $(jq --raw-output '.[]' < repo.json); do
mkdir debs
# Put package lists into directory with *.deb files so they will be transferred to
# upload job.
test -f ./built_${repo}_packages.txt && mv ./built_${repo}_packages.txt ./debs/built_packages.txt
test -f ./built_${repo}_subpackages.txt && cat ./built_${repo}_subpackages.txt >> ./debs/built_packages.txt \
test -f ./built_${repo}_packages.txt && mv ./built_${repo}_packages.txt ./debs/
test -f ./built_${repo}_subpackages.txt && cat ./built_${repo}_subpackages.txt >> ./debs/built_${repo}_packages.txt \
&& rm ./built_${repo}_subpackages.txt
test -f ./deleted_${repo}_packages.txt && mv ./deleted_${repo}_packages.txt ./debs/deleted_packages.txt
test -f ./deleted_${repo}_packages.txt && mv ./deleted_${repo}_packages.txt ./debs/
# Move only debs from built_packages into debs/ folder before
# creating an archive.
while read -r pkg; do
# Match both $pkg.deb and $pkg-static.deb.
find output \( -name "$pkg_*.deb" -o -name "$pkg-static_*.deb" \) -type f -print0 | xargs -0r mv -t debs/
done < <(cat ./debs/built_packages.txt)
# Files containing certain symbols (e.g. ":") will cause failure in actions/upload-artifact.
# Archiving *.deb files in a tarball to avoid issues with uploading.
tar cf artifacts/debs-${repo}-${{ matrix.target_arch }}-${{ github.sha }}.tar debs
rm -r debs/
done < <(cat ./debs/built_${repo}_packages.txt)
done
# Files containing certain symbols (e.g. ":") will cause failure in actions/upload-artifact.
# Archiving *.deb files in a tarball to avoid issues with uploading.
tar cf artifacts/debs-${{ matrix.target_arch }}-${{ github.sha }}.tar debs
- name: Checksums for built *.deb files
if: always()
run: |
@ -244,17 +240,17 @@ jobs:
source scripts/aptly_api.sh
for archive in debs-*/debs-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
tar xf "$archive"
done
for repo in $(jq --raw-output '.[]' < repo.json); do
export REPOSITORY_NAME=$repo
for archive in debs-*/debs-$repo-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
tar xf "$archive"
done
# Upload file to temporary directory.
uploaded_files=false
shopt -s nullglob
for filename in $(cat debs/built_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
for filename in $(cat debs/built_${repo}_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
if ! aptly_upload_file "$filename"; then
exit 1
fi
@ -277,10 +273,6 @@ jobs:
exit 1
fi
fi
# Delete the debs folder in order to not upload packages from one repo to other
# TODO(@thunder-coding): Perhaps it would make sense to make use of tar's `-C` option in order to prevent extracting the archives twice
rm -rf debs/
done
- name: Upload to grimler.se
# Run even if upload to packages.termux.org failed:
@ -298,14 +290,10 @@ jobs:
for repo in $(jq --raw-output '.[]' < repo.json); do
export REPOSITORY_NAME=$repo
for archive in debs-*/debs-$repo-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
tar xf "$archive"
done
# Upload file to temporary directory.
uploaded_files=false
shopt -s nullglob
for filename in $(cat debs/built_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
for filename in $(cat debs/built_${repo}_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
if ! aptly_upload_file "$filename"; then
exit 1
fi
@ -329,6 +317,4 @@ jobs:
# exit 1
# fi
fi
# Delete the debs folder in order to not upload packages from one repo to other
rm -rf debs/
done