-
-
Save rahulmr/4c699f41f6479a46cd8b90123a91ba95 to your computer and use it in GitHub Desktop.
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
image: node:10.15.0 | |
test: &test | |
name: Install and Test | |
script: | |
- cd my-tools | |
- npm install | |
- npm test | |
- npm pack | |
artifacts: # defining the artifacts to be passed to each future step. | |
# - dist/** | |
# - folder/files*.txt | |
- my-tools/my-tools-*.tgz | |
upload: &upload | |
name: Upload to S3 | |
image: your-own-aws-deployment-image:latest | |
script: | |
- cd my-tools | |
- echo "$BITBUCKET_BRANCH" | |
- | | |
if [ -z "$AWS_ACCESS_KEY_ID" ]; then | |
echo "AWS credentials not found; skipping deployment..."; | |
elif [ -z "$BITBUCKET_BRANCH" ]; then | |
echo "Current branch not found; skipping deployment..."; | |
elif [[ "$BITBUCKET_BRANCH" != dev ]] && [[ "$BITBUCKET_BRANCH" != master ]]; then | |
echo "Current branch does not appear to be a valid environment; skipping deployment..."; | |
else | |
echo "all good, ready to upload to s3"; | |
for f in `ls my-tools-*.tgz`; do | |
aws s3 cp "$f" "s3://${MY_TOOLS_BUCKET}/" | |
done | |
fi | |
pipelines: | |
default: | |
- step: | |
<<: *test | |
branches: | |
master: | |
- step: | |
<<: *test | |
- step: | |
<<: *upload | |
deployment: production | |
dev: | |
- step: | |
<<: *test | |
- step: | |
<<: *upload | |
deployment: dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment