Skip to content

Commit

Permalink
Fix typos, ensure to create tmp directory and defensively guard paths…
Browse files Browse the repository at this point in the history
… in bash scripts using quotes
  • Loading branch information
WojciechMazur committed Oct 16, 2024
1 parent 4e06ffe commit a053fba
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -769,36 +769,38 @@ jobs:
- name: Prepare the SDKs
run : |
function prepareSDK() {
distroSuffix=$1
artifactId=$2
distroSuffix="$1"
artifactId="$2"
artifactName="scala3-${{ env.RELEASE_TAG }}${distroSuffix}"
downloadedArchive="./artifact.zip"
if [[ -f "${downloadedArchive}" ]]; then
rm $downloadedArchive
rm "${downloadedArchive}"
fi
# Download previously prepared SDK bundle
curl -L \
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-o ${downloadedArchive} \
-H "Accept: application/vnd.github+json" \
-o "${downloadedArchive}" \
--retry 5 --retry-delay 10 --retry-connrefused \
--max-time 600 --connect-timeout 60 \
https://api.github.com/repos/scala/scala3/actions/artifacts/${artifactId}/zip
# Repackage content of .zip to .tar.gz and prepare digest
tmpDir="./archive-tmp-dir"
if [[ -f "${tmpDir}" ]]; then
rm -r ${tmpDir}
if [[ -d "${tmpDir}" ]]; then
rm -r "${tmpDir}"
fi
unzip ${downloadedArchive} -d ${tmpDir}
mkdir "${tmpDir}"
unzip "${downloadedArchive}" -d "${tmpDir}"
mv ${downloadedArchive} ./${artifactName}.zip
tar -czf ${artifactName}.tar.gz -C ${tmpDir} .
mv "${downloadedArchive}" "./${artifactName}.zip"
tar -czf "${artifactName}.tar.gz" -C "${tmpDir}" .
# Caluclate SHA for each of archive files
for file in ./${artifactName}.zip ./${artifactName}.tar.gz; do
sha256sum ${file} | cut -d " " -f 1 > ${file}.sha256
for file in "./${artifactName}.zip" "./${artifactName}.tar.gz"; do
sha256sum "${file}" | cut -d " " -f 1 > "${file}.sha256"
done
}
prepareSDK "" ${{needs.build-sdk-package.outputs.universal-id}}
Expand Down

0 comments on commit a053fba

Please sign in to comment.