-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4026 from esl/publish-packages
Publish packages from CircleCI
- Loading branch information
Showing
7 changed files
with
70 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,21 @@ | ||
#!/usr/bin/env sh | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Params - override for your env | ||
SHA256SUM="shasum -a 256" | ||
REMOTE_SHA256SUM=sha256sum | ||
PACKAGES_LOCAL=packages | ||
. env/publish | ||
cd tools/pkg/packages | ||
PACKAGE_NAME=$(ls) | ||
PKG_PROFILE=packages | ||
prefix=${pkg_PLATFORM/_//} | ||
|
||
# CLI arguments | ||
VERSION=${1:-"(missing)"} | ||
REVISION=${2:-1} | ||
|
||
if [ x"$VERSION" = x"(missing)" ]; then | ||
echo "usage: $0 VERSION [REVISION]" | ||
echo | ||
echo Look for package \$VERSION-\$REVISION and publish to $PACKAGES_HOST. | ||
exit 1 | ||
if which aws ; then | ||
echo "aws tool ready" | ||
else | ||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
unzip -q awscliv2.zip | ||
sudo ./aws/install | ||
fi | ||
|
||
set +e | ||
PKG=$(ls -1 ${PACKAGES_LOCAL} | grep "$VERSION-$REVISION" | head -1) | ||
if [ -z "$PKG" ]; then | ||
echo "$0: can't find package version $VERSION-$REVISION" | ||
exit 2 | ||
fi | ||
set -e | ||
aws configure set aws_access_key_id "$PKG_ACCESS_KEY_ID" --profile "$PKG_PROFILE" | ||
aws configure set aws_secret_access_key "$PKG_SECRET_ACCESS_KEY" --profile "$PKG_PROFILE" | ||
|
||
rsync $PACKAGES_LOCAL/$PKG $PACKAGES_HOST:$PACKAGES_PATH | ||
CHKSUM=$($SHA256SUM $PACKAGES_LOCAL/$PKG) | ||
REMOTE_CHKSUM=$(ssh $PACKAGES_HOST "cd $PACKAGES_PATH && $REMOTE_SHA256SUM $PKG") | ||
|
||
if [ x"$(echo $CHKSUM | cut -d" " -f1)" != x"$(echo $REMOTE_CHKSUM | cut -d" " -f1)" ]; then | ||
echo "$0: checksum mismatch - try again or check your connection" | ||
exit 3 | ||
fi | ||
ssh $PACKAGES_HOST "sed -i /$VERSION-$REVISION/d $PACKAGES_PATH/sha256sum " \ | ||
"&& echo $REMOTE_CHKSUM >> $PACKAGES_PATH/sha256sum" | ||
echo Package $PKG is now public at: | ||
echo https://$PACKAGES_HOST/$PACKAGES_PROJECT/$PKG | ||
aws s3 cp "$PACKAGE_NAME" "s3://arn:aws:s3:$PKG_AWS_REGION:$PKG_USER_ID:accesspoint/mim-packages/$prefix/$PACKAGE_NAME" --acl public-read --profile "$PKG_PROFILE" --region "$PKG_AWS_REGION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters