From ca2e7bcf7361099054740f954be0d4b0b9874a06 Mon Sep 17 00:00:00 2001 From: Yaksh Bariya Date: Thu, 5 May 2022 18:26:09 +0530 Subject: [PATCH] ci(packages): Do not unconditionally publish repo when no changes are made to other repos --- .github/workflows/packages.yml | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 43a15045a..ef2241395 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -254,27 +254,30 @@ jobs: # Upload file to temporary directory. uploaded_files=false shopt -s nullglob - 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 + + if [ -f debs/built_${REPOSITORY_NAME}_packages.txt ]; then + 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 - uploaded_files=true - done - shopt -u nullglob + uploaded_files=true + done + shopt -u nullglob - # Publishing repository changes. - if [ "$uploaded_files" = "true" ]; then - if ! aptly_add_to_repo; then - exit 1 - fi + # Publishing repository changes. + if [ "$uploaded_files" = "true" ]; then + if ! aptly_add_to_repo; then + exit 1 + fi - # Usually temporary directory is deleted automatically, but in certain cases it is left. - aptly_delete_dir + # Usually temporary directory is deleted automatically, but in certain cases it is left. + aptly_delete_dir - # Final part to make changes appear in web root. - if ! aptly_publish_repo; then - exit 1 + # Final part to make changes appear in web root. + if ! aptly_publish_repo; then + exit 1 + fi fi fi done