@ -78,8 +78,8 @@ jobs:
cd ..
fi
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"] ' < repo.json)
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"] .name ' repo.json)
# Parse changed files and identify new packages and deleted packages.
# Create lists of those packages that will be passed to upload job for
# further processing.
@ -113,10 +113,10 @@ jobs:
done
else
for pkg in ${{ github.event.inputs.packages }}; do
repo_paths=$(jq --raw-output 'keys | .[]' < repo.json)
repo_paths=$(jq --raw-output 'keys | .[]' repo.json)
found=false
for repo_path in $repo_paths; do
repo=$(jq --raw-output '.["'${repo_path}'"] ' < repo.json)
repo=$(jq --raw-output '.["'${repo_path}'"] .name ' repo.json)
if [ -d "${repo_path}/${pkg}" ]; then
found=true
echo "$pkg" >> ./built_${repo}_packages.txt
@ -132,7 +132,7 @@ jobs:
done
fi
for repo in $(jq --raw-output '.[]' < repo.json); do
for repo in $(jq --raw-output '.[]' repo.json); do
# Fix so that lists do not contain duplicates
if [ -f ./built_${repo}_packages.txt ]; then
uniq ./built_${repo}_packages.txt > ./built_${repo}_packages.txt.tmp
@ -161,8 +161,8 @@ jobs:
- name : Lint packages
run : |
declare -a package_recipes
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"] ' < repo.json)
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"] .name ' repo.json)
if [ -f ./built_${repo}_packages.txt ]; then
package_recipes="$package_recipes $(cat ./built_${repo}_packages.txt | repo_path=${repo_path} awk '{print ENVIRON["repo_path"]"/"$1"/build.sh"}')"
fi
@ -175,8 +175,8 @@ jobs:
- name : Build packages
run : |
declare -a packages
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"] ' < repo.json)
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
repo=$(jq --raw-output '.["'${repo_path}'"] .name ' repo.json)
if [ -f ./built_${repo}_packages.txt ]; then
packages="$packages $(cat ./built_${repo}_packages.txt)"
@ -192,7 +192,7 @@ jobs:
run : |
test -d termux-packages/output && mv termux-packages/output/* ./output/
for repo in $(jq --raw-output '.[] ' < repo.json); do
for repo in $(jq --raw-output '.[] .name ' repo.json); do
# 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/
@ -235,7 +235,6 @@ jobs:
path : ./
- name : Upload to packages.termux.org
env:
REPOSITORY_DISTRIBUTION : stable
REPOSITORY_URL : https://packages.termux.org/aptly-api
run : |
GITHUB_SHA=${{ github.sha }}
@ -248,13 +247,14 @@ jobs:
tar xf "$archive"
done
for repo in $(jq --raw-output '.[]' < repo.json); do
export REPOSITORY_NAME=$repo
for repo in $(jq --raw-output 'keys | .[]' repo.json); do
export REPOSITORY_NAME=$(jq --raw-output '.["'$repo'"].name' repo.json)
export REPOSITORY_DISTRIBUTION=$(jq --raw-output '.["'$repo'"].distribution' repo.json)
# Upload file to temporary directory.
uploaded_files=false
shopt -s nullglob
for filename in $(cat debs/built_${ repo }_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
for filename in $(cat debs/built_${ REPOSITORY_NAME }_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
if ! aptly_upload_file "$filename"; then
exit 1
fi
@ -262,7 +262,7 @@ jobs:
uploaded_files=true
done
shopt -u nullglob
# Publishing repository changes.
if [ "$uploaded_files" = "true" ]; then
if ! aptly_add_to_repo; then
@ -282,7 +282,6 @@ jobs:
# Run even if upload to packages.termux.org failed:
if : always()
env:
REPOSITORY_DISTRIBUTION : stable
REPOSITORY_URL : https://aptly-api.grimler.se
run : |
GITHUB_SHA=${{ github.sha }}
@ -291,13 +290,14 @@ jobs:
source scripts/aptly_api.sh
for repo in $(jq --raw-output '.[]' < repo.json); do
export REPOSITORY_NAME=$repo
for repo in $(jq --raw-output 'keys | .[]' repo.json); do
export REPOSITORY_NAME=$(jq --raw-output '.["'$repo'"].name' repo.json)
export REPOSITORY_DISTRIBUTION=$(jq --raw-output '.["'$repo'"].distribution' repo.json)
# Upload file to temporary directory.
uploaded_files=false
shopt -s nullglob
for filename in $(cat debs/built_${ repo }_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
for filename in $(cat debs/built_${ REPOSITORY_NAME }_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
if ! aptly_upload_file "$filename"; then
exit 1
fi