Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/deploy/publish-build-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ publishPackage() {
commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)
commitMessage=$(git log --oneline -n 1)

buildVersionName="${buildVersion}-${commitSha}"
# Note that we cannot store the commit SHA in its own version segment
# as it will not comply with the semver specification. For example:
# 1.0.0-00abcdef will break since the SHA starts with zeros. To fix this,
# we create a new version segment with the following format: "1.0.0-sha-00abcdef".
# See issue: https://jubianchi.github.io/semver-check/#/^8.0.0/8.2.2-0462599
buildVersionName="${buildVersion}-sha-${commitSha}"
buildTagName="${branchName}-${commitSha}"
buildCommitMessage="${branchName} - ${commitMessage}"

Expand Down Expand Up @@ -89,7 +94,7 @@ publishPackage() {

# Replace the version in every file recursively with a more specific version that also includes
# the SHA of the current build job. Normally this "sed" call would just replace the version
# placeholder, but the version placeholders have been replaced by the release task already.
# placeholder, but the version placeholders have been replaced by "npm_package" already.
sed -i "s/${buildVersion}/${buildVersionName}/g" $(find . -type f -not -path '*\/.*')

echo "Updated the build version in every file to include the SHA of the latest commit."
Expand Down
12 changes: 11 additions & 1 deletion scripts/deploy/publish-docs-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)
commitMessage=$(git log --oneline -n 1)
commitTag="${buildVersion}-${commitSha}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider removing this line as it isn't used anymore.


buildVersionName="${buildVersion}-${commitSha}"
# Note that we cannot store the commit SHA in its own version segment
# as it will not comply with the semver specification. For example:
# 1.0.0-00abcdef will break since the SHA starts with zeros. To fix this,
# we create a new version segment with the following format: "1.0.0-sha-00abcdef".
# See issue: https://jubianchi.github.io/semver-check/#/^8.0.0/8.2.2-0462599
buildVersionName="${buildVersion}-sha-${commitSha}"
buildTagName="${branchName}-${commitSha}"
buildCommitMessage="${branchName} - ${commitMessage}"

Expand Down Expand Up @@ -86,6 +91,11 @@ if [[ $(git ls-remote origin "refs/tags/${buildTagName}") ]]; then
exit 0
fi

# Replace the version in every file recursively with a more specific version that also includes
# the SHA of the current build job. Normally this "sed" call would just replace the version
# placeholder, but the version placeholders have been replaced by "npm_package" already.
sed -i "s/${buildVersion}/${buildVersionName}/g" $(find . -type f -not -path '*\/.*')

# Setup the Git configuration
git config user.name "$commitAuthorName"
git config user.email "$commitAuthorEmail"
Expand Down