Skip to content

Commit 485ce64

Browse files
gkalpakmatsko
authored andcommitted
ci: use more descriptive names for published build artifacts (angular#33957)
In efbbae5, the `publish_packages_as_artifacts` CircleCI job was created to publish the build artifacts of PR builds on CI. In a8f4f14, its scope was expanded to also publish build artifacts on non-PR builds. The published artifacts names are constructed based on the PR number (e.g. include `-pr12345-`), so on non-PR builds the names do not reflect the source branch (instead, they include `-prfalse-`). This commit fixes this by using the current branch name. For example, artifact names for the `master` or `9.0.x` branch will include `-master-` and `-9.0.x-` respectively (instead of `-prfalse-`). (NOTE: For PRs, where branch name is `pull/12345`, the branch name is transformed to `pr12345`.) PR Close angular#33957
1 parent dca6ad8 commit 485ce64

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,14 @@ jobs:
578578
# Publish `@angular/*` packages.
579579
- run:
580580
name: Create artifacts for @angular/* packages
581-
command: ./scripts/ci/create-package-archives.sh $CI_PULL_REQUEST $CI_COMMIT $NG_PACKAGES_DIR $NG_PACKAGES_ARCHIVES_DIR
581+
command: ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $NG_PACKAGES_DIR $NG_PACKAGES_ARCHIVES_DIR
582582
- store_artifacts:
583583
path: *ng_packages_archives_dir
584584
destination: angular
585585
# Publish `zone.js` package.
586586
- run:
587587
name: Create artifacts for zone.js package
588-
command: ./scripts/ci/create-package-archives.sh $CI_PULL_REQUEST $CI_COMMIT $ZONEJS_PACKAGES_DIR $ZONEJS_PACKAGES_ARCHIVES_DIR
588+
command: ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $ZONEJS_PACKAGES_DIR $ZONEJS_PACKAGES_ARCHIVES_DIR
589589
- store_artifacts:
590590
path: *zonejs_packages_archives_dir
591591
destination: zone.js

scripts/ci/create-package-archives.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
set -eu -o pipefail
44

5-
readonly prNumber="$1"
6-
readonly prLastSha="${2:0:7}"
5+
readonly safeBranchName="$(echo $1 | sed 's/^pull\//pr/' | sed 's/[^A-Za-z0-9_.-]/_/g')"
6+
readonly shortLastSha="$(git rev-parse --short $2)"
77
readonly inputDir="$PROJECT_ROOT/$3"
88
readonly outputDir="$PROJECT_ROOT/$4"
9-
readonly fileSuffix="-pr$prNumber-$prLastSha.tgz"
9+
readonly fileSuffix="-$safeBranchName-$shortLastSha.tgz"
1010

1111
echo "Creating compressed archives for packages in '$inputDir'."
1212

0 commit comments

Comments
 (0)