mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 11:06:56 +08:00
Trim leading whitespace.
This commit is contained in:
20
.github/workflows/NightlyRelease.yml
vendored
20
.github/workflows/NightlyRelease.yml
vendored
@@ -168,18 +168,25 @@ jobs:
|
|||||||
export GH_TOKEN=${{ github.token }}
|
export GH_TOKEN=${{ github.token }}
|
||||||
|
|
||||||
ERRORS=0
|
ERRORS=0
|
||||||
|
# A dictionary of 0/1 to avoid duplicate downloads
|
||||||
declare -A downloadedArtifacts
|
declare -A downloadedArtifacts
|
||||||
|
# A dictionary to check for duplicate asset files in release
|
||||||
declare -A assetFilenames
|
declare -A assetFilenames
|
||||||
while IFS=$'\r\n' read -r AssetLine; do
|
while IFS=$'\r\n' read -r assetLine; do
|
||||||
if [[ "${AssetLine}" == "" ]]; then
|
if [[ "${assetLine}" == "" ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
artifact="${AssetLine%%:*}"
|
# split assetLine colon separated triple: artifact:asset:title
|
||||||
remaining="${AssetLine#*:}"
|
artifact="${assetLine%%:*}"
|
||||||
|
remaining="${assetLine#*:}"
|
||||||
asset="${remaining%%:*}"
|
asset="${remaining%%:*}"
|
||||||
title="${remaining##*:}"
|
title="${remaining##*:}"
|
||||||
|
|
||||||
|
# remove leading whitespace
|
||||||
|
asset="${asset#"${asset%%[![:space:]]*}"}"
|
||||||
|
title="${title#"${title%%[![:space:]]*}"}"
|
||||||
|
|
||||||
echo "Publish asset '${asset}' from artifact '${artifact}' with title '${title}'"
|
echo "Publish asset '${asset}' from artifact '${artifact}' with title '${title}'"
|
||||||
echo -n " Checked asset for duplicates ... "
|
echo -n " Checked asset for duplicates ... "
|
||||||
if [[ -n "${assetFilenames[$asset]}" ]]; then
|
if [[ -n "${assetFilenames[$asset]}" ]]; then
|
||||||
@@ -192,6 +199,7 @@ jobs:
|
|||||||
assetFilenames[$asset]=1
|
assetFilenames[$asset]=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Download artifact by artifact name
|
||||||
if [[ -n "${downloadedArtifacts[$artifact]}" ]]; then
|
if [[ -n "${downloadedArtifacts[$artifact]}" ]]; then
|
||||||
echo -e " downloading '${artifact}' ... ${ANSI_LIGHT_YELLOW}[SKIPPED]${ANSI_NOCOLOR}"
|
echo -e " downloading '${artifact}' ... ${ANSI_LIGHT_YELLOW}[SKIPPED]${ANSI_NOCOLOR}"
|
||||||
else
|
else
|
||||||
@@ -210,6 +218,7 @@ jobs:
|
|||||||
downloadedArtifacts[$artifact]=1
|
downloadedArtifacts[$artifact]=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if artifact should be compressed (zip, tgz) or if asset was part of the downloaded artifact.
|
||||||
echo -n " checking asset '${artifact}/${asset}' ... "
|
echo -n " checking asset '${artifact}/${asset}' ... "
|
||||||
if [[ "${asset}" == !*zip ]]; then
|
if [[ "${asset}" == !*zip ]]; then
|
||||||
echo -e "${ANSI_LIGHT_GREEN}[ZIP]${ANSI_NOCOLOR}"
|
echo -e "${ANSI_LIGHT_GREEN}[ZIP]${ANSI_NOCOLOR}"
|
||||||
@@ -256,6 +265,7 @@ jobs:
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Upload asset to existing release page
|
||||||
echo -n " uploading asset '${asset}' from '${uploadFile}' with title '${title}' ... "
|
echo -n " uploading asset '${asset}' from '${uploadFile}' with title '${title}' ... "
|
||||||
gh release upload ${{ inputs.nightly_name }} "${uploadFile}#${title}" --clobber
|
gh release upload ${{ inputs.nightly_name }} "${uploadFile}#${title}" --clobber
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
@@ -270,7 +280,7 @@ jobs:
|
|||||||
done <<<"${{ inputs.assets }}"
|
done <<<"${{ inputs.assets }}"
|
||||||
|
|
||||||
echo "Inspecting downloaded artifacts ..."
|
echo "Inspecting downloaded artifacts ..."
|
||||||
tree .
|
tree -L 3 .
|
||||||
|
|
||||||
if [[ $ERROR -ne 0 ]]; then
|
if [[ $ERROR -ne 0 ]]; then
|
||||||
echo -e "${ANSI_LIGHT_RED}Errors detected in previous steps.${ANSI_NOCOLOR}"
|
echo -e "${ANSI_LIGHT_RED}Errors detected in previous steps.${ANSI_NOCOLOR}"
|
||||||
|
|||||||
Reference in New Issue
Block a user