Skip to content

Commit

Permalink
fix: correct path concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
karlbaumhauer committed Jun 30, 2023
1 parent 039ae5f commit 87f363d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .azuredevops/pipelines/deploy-to-cdn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ steps:
echo "The last commit is not a version bump => code will not be deployed."
echo "##vso[task.setvariable variable=deployment]none"
fi
displayName: 'Check if code is deployable'
displayName: 'Set deployment type'
- bash: |
echo "$(deployment)"
displayName: 'Log deployment type'
Expand Down
2 changes: 1 addition & 1 deletion .azuredevops/pipelines/templates/purge-cdn.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
--resource-group rg-staticcontent-prod-frontend-cdn \
--profile-name cdn-staticcontent-prod-frontend-cdn \
--name "fe-solid-design-system-prod" \
--content-paths "/$versionPath/*" \
--content-paths "/$version/*" \
--no-wait
set +x
Expand Down
74 changes: 42 additions & 32 deletions .azuredevops/pipelines/templates/push-to-storage-main.template.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
steps:
- bash: |
path=""
if [[ $deployment != "none" ]]; then
version=$(node -p "require('./package.json').version")
echo "Version is $version"
versionArray=($(echo "$version" | tr '.' ' '))
echo "Version array is ${versionArray[@]}"
# set version paths
echo "Version path is: $version"
patchWildcardPath="x.x.x"
echo "Patch-wildcard path is: ${patchWildcardPath"
majorWildcardPath="${versionArray[0]}.x.x"
echo "Major-wildcard path is: ${majorWildcardPath}"
minorWildcardPath="${versionArray[0]}.${versionArray[1]}.x"
echo "Minor-wildcard path is: ${minorWildcardPath}"
# If docs-only changes, set paths to storybook
if [[ $deployment == "docs" ]]; then
path="/storybook"
version+=$path
patchWildcardPath+=${path}
echo "Patch-wildcard path is: $patchWildcardPath"
majorWildcardPath+=${path}
echo "Major-wildcard path is: $majorWildcardPath"
minorWildcardPath+=${path}
echo "Minor-wildcard path is: $minorWildcardPath"
fi
fi
displayName: 'Set version variables'
## Deploy to CDN
- task: AzureCLI@2
displayName: 'Deploying to Azure Blob Storage'
Expand All @@ -7,72 +38,51 @@ steps:
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
path=""
# If docs-only changes, set path to storybook
if [[ $deployment == "docs" ]]; then
path="/storybook"
fi
if [[ $deployment != "none" ]]; then
version=$(node -p "require('./package.json').version")
echo "Version is $version"
versionArray=($(echo "$version" | tr '.' ' '))
echo "Version array is ${versionArray[@]}"
# Deploy to version folder
set -x
echo "Target folder is $version"
az storage blob upload-batch \
--destination \$web \
--account-name "safesoliddesignsysprod" \
--source dist${path} \
--destination-path "/${version}${path}" \
--source "dist${path}" \
--destination-path "/$version" \
--overwrite
set +x
# Deploy to latest folder
# Deploy to patch wildcard folder
set -x
echo "Target folder is x.x.x"
az storage blob upload-batch \
--destination \$web \
--account-name "safesoliddesignsysprod" \
--source dist${path} \
--destination-path "/x.x.x${path}" \
--source "dist${path}" \
--destination-path "/$patchWildcardPath" \
--overwrite
set +x
# Deploy to patch wildcard folder
# Deploy to minor wildcard folder
set -x
echo "Target folder is ${versionArray[0]}.${versionArray[1]}.x"
az storage blob upload-batch \
--destination \$web \
--account-name "safesoliddesignsysprod" \
--source dist${path} \
--destination-path "/${versionArray[0]}.${versionArray[1]}.x${path}" \
--source "dist${path}" \
--destination-path "/$minorWildcardPath" \
--overwrite
set +x
# Deploy to minor wildcard folder
# Deploy to major wildcard folder
set -x
echo "Target folder is ${versionArray[0]}.x.x"
az storage blob upload-batch \
--destination \$web \
--account-name "safesoliddesignsysprod" \
--source dist${path} \
--destination-path "/${versionArray[0]}.x.x${path}" \
--source "dist${path}" \
--destination-path "/$majorWildcardPath" \
--overwrite
set +x
fi
- bash: |
versionPath="${version}${path}"
echo "Version path is: $versionPath"
patchWildcardPath="x.x.x${path}"
echo "Patch-wildcard path is: $patchWildcardPath"
majorWildcardPath="${versionArray[0]}.x.x${path}"
echo "Major-wildcard path is: $majorWildcardPath"
minorWildcardPath="${versionArray[0]}.${versionArray[1]}.x${path}"
echo "Minor-wildcard path is: $minorWildcardPath"
displayName: 'Set version paths'
## Purge CDN for all folders
- template: purge-cdn.template.yml

0 comments on commit 87f363d

Please sign in to comment.