Skip to content

Commit a053fba

Browse files
committed
Fix typos, ensure to create tmp directory and defensively guard paths in bash scripts using quotes
1 parent 4e06ffe commit a053fba

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -769,36 +769,38 @@ jobs:
769769
- name: Prepare the SDKs
770770
run : |
771771
function prepareSDK() {
772-
distroSuffix=$1
773-
artifactId=$2
772+
distroSuffix="$1"
773+
artifactId="$2"
774774
artifactName="scala3-${{ env.RELEASE_TAG }}${distroSuffix}"
775775
776776
downloadedArchive="./artifact.zip"
777777
if [[ -f "${downloadedArchive}" ]]; then
778-
rm $downloadedArchive
778+
rm "${downloadedArchive}"
779779
fi
780780
781781
# Download previously prepared SDK bundle
782782
curl -L \
783783
-H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
784-
-o ${downloadedArchive} \
784+
-H "Accept: application/vnd.github+json" \
785+
-o "${downloadedArchive}" \
785786
--retry 5 --retry-delay 10 --retry-connrefused \
786787
--max-time 600 --connect-timeout 60 \
787788
https://api.github.com/repos/scala/scala3/actions/artifacts/${artifactId}/zip
788789
789790
# Repackage content of .zip to .tar.gz and prepare digest
790791
tmpDir="./archive-tmp-dir"
791-
if [[ -f "${tmpDir}" ]]; then
792-
rm -r ${tmpDir}
792+
if [[ -d "${tmpDir}" ]]; then
793+
rm -r "${tmpDir}"
793794
fi
794-
unzip ${downloadedArchive} -d ${tmpDir}
795+
mkdir "${tmpDir}"
796+
unzip "${downloadedArchive}" -d "${tmpDir}"
795797
796-
mv ${downloadedArchive} ./${artifactName}.zip
797-
tar -czf ${artifactName}.tar.gz -C ${tmpDir} .
798+
mv "${downloadedArchive}" "./${artifactName}.zip"
799+
tar -czf "${artifactName}.tar.gz" -C "${tmpDir}" .
798800
799801
# Caluclate SHA for each of archive files
800-
for file in ./${artifactName}.zip ./${artifactName}.tar.gz; do
801-
sha256sum ${file} | cut -d " " -f 1 > ${file}.sha256
802+
for file in "./${artifactName}.zip" "./${artifactName}.tar.gz"; do
803+
sha256sum "${file}" | cut -d " " -f 1 > "${file}.sha256"
802804
done
803805
}
804806
prepareSDK "" ${{needs.build-sdk-package.outputs.universal-id}}

0 commit comments

Comments
 (0)