Skip to content

Commit 339cc9b

Browse files
committed
ci: fix v0.3.2 artifact recovery names
1 parent 8be8845 commit 339cc9b

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/release-v032-from-artifacts.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,15 @@ jobs:
180180
continue
181181
fi
182182
183-
artifact_file="$(
184-
find "${download_dir}" -type f \( -name "${expected_file}" -o -name "${artifact_name}" \) | head -n 1
185-
)"
183+
artifact_file="$(find "${download_dir}" -type f | head -n 1)"
186184
if [[ -z "${artifact_file}" ]]; then
187-
echo "Run ${run_id} artifact ${artifact_name} did not contain ${expected_file}."
185+
echo "Run ${run_id} artifact ${artifact_name} did not contain any files."
188186
continue
189187
fi
190188
191189
cp "${artifact_file}" "artifact/${expected_file}"
192190
run_head_sha="$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}" --jq '.head_sha')"
193-
printf '%s\t%s\t%s\t%s\n' "${expected_file}" "${artifact_name}" "${run_id}" "${run_head_sha}" >> recovery/artifact-provenance.tsv
191+
printf '%s\t%s\t%s\t%s\t%s\n' "${expected_file}" "$(basename "${artifact_file}")" "${artifact_name}" "${run_id}" "${run_head_sha}" >> recovery/artifact-provenance.tsv
194192
found="true"
195193
break
196194
done
@@ -239,6 +237,21 @@ jobs:
239237
done
240238
241239
for tar_file in artifact/*.tar.gz; do
240+
real_tar_file="$(realpath "${tar_file}")"
241+
repack_dir="$(mktemp -d)"
242+
tar -xzf "${real_tar_file}" -C "${repack_dir}"
243+
mapfile -t top_entries < <(find "${repack_dir}" -mindepth 1 -maxdepth 1 | sort)
244+
if [[ "${#top_entries[@]}" -ne 1 || ! -d "${top_entries[0]}" ]]; then
245+
echo "${tar_file} does not contain exactly one top-level directory." >&2
246+
exit 1
247+
fi
248+
top_dir="${top_entries[0]}"
249+
normalized_dir="${repack_dir}/beellama-${TAG_NAME}"
250+
if [[ "${top_dir}" != "${normalized_dir}" ]]; then
251+
mv "${top_dir}" "${normalized_dir}"
252+
fi
253+
tar -czf "${real_tar_file}" -C "${repack_dir}" "beellama-${TAG_NAME}"
254+
rm -rf "${repack_dir}"
242255
mv "${tar_file}" release/
243256
done
244257

0 commit comments

Comments
 (0)