Skip to content

Commit 898cded

Browse files
devversionandrewseguin
authored andcommitted
build(artifacts): sed should not update .git/ files (#8938)
* Adds more logging messages to the publish artifacts script (better debugging) * Updates the `find` command for the version `sed` call to no longer match files inside of the `.git/` directory (might lead to a broken .git/ setup)
1 parent f95f832 commit 898cded

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/deploy/publish-build-artifacts.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ publishPackage() {
4141
repoUrl="https://github.com/angular/${packageRepo}.git"
4242
repoDir="tmp/${packageRepo}"
4343

44+
echo "Starting publish process of ${packageName} for ${commitTag}.."
45+
4446
if [[ ! ${COMMAND_ARGS} == *--no-build* ]]; then
4547
# Create a release of the current repository.
4648
$(npm bin)/gulp ${packageName}:build-release:clean
@@ -50,16 +52,24 @@ publishPackage() {
5052
rm -rf ${repoDir}
5153
mkdir -p ${repoDir}
5254

55+
echo "Starting cloning process of ${repoUrl} into ${repoDir}.."
56+
5357
# Clone the repository and only fetch the last commit to download less unused data.
5458
git clone ${repoUrl} ${repoDir} --depth 1
5559

60+
echo "Successfully cloned ${repoUrl} into ${repoDir}."
61+
5662
# Copy the build files to the repository
5763
rm -rf ${repoDir}/*
5864
cp -r ${buildDir}/* ${repoDir}
5965

66+
echo "Removed everything from ${packageRepo} and added the new build output."
67+
6068
# Create the build commit and push the changes to the repository.
6169
cd ${repoDir}
6270

71+
echo "Switched into the repository directory (${repoDir})."
72+
6373
if [[ $(git ls-remote origin "refs/tags/${commitTag}") ]]; then
6474
echo "Skipping publish because tag is already published"
6575
exit 0
@@ -68,7 +78,9 @@ publishPackage() {
6878
# Replace the version in every file recursively with a more specific version that also includes
6979
# the SHA of the current build job. Normally this "sed" call would just replace the version
7080
# placeholder, but the version placeholders have been replaced by the release task already.
71-
sed -i "s/${buildVersion}/${commitTag}/g" $(find . -type f)
81+
sed -i "s/${buildVersion}/${commitTag}/g" $(find . -type f -not -path '*\/.*')
82+
83+
echo "Updated the build version in every file to include the SHA of the latest commit."
7284

7385
# Prepare Git for pushing the artifacts to the repository.
7486
git config user.name "${commitAuthorName}"
@@ -77,6 +89,8 @@ publishPackage() {
7789

7890
echo "https://${MATERIAL2_BUILDS_TOKEN}:@github.com" > .git/credentials
7991

92+
echo "Git configuration has been updated to match the last commit author. Publishing now.."
93+
8094
git add -A
8195
git commit --allow-empty -m "${commitMessage}"
8296
git tag "${commitTag}"

0 commit comments

Comments
 (0)