-
Notifications
You must be signed in to change notification settings - Fork 63
Release improvements #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
farleyb-amazon
merged 6 commits into
aws:master
from
farleyb-amazon:release-improvements
Jun 4, 2021
Merged
Release improvements #618
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7051d97
chore: Release improvements
farleyb-amazon adb0c20
Uncomment some stuff
farleyb-amazon 40b6e1e
Add secrets
farleyb-amazon 48206e4
Grab OTP
farleyb-amazon 79e13c5
Add publishing steps
farleyb-amazon 53b58f1
Updates per offline discussion
farleyb-amazon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
version: 0.2 | ||
|
||
env: | ||
variables: | ||
NODE_OPTIONS: "--max-old-space-size=4096" | ||
BRANCH: "master" | ||
secrets-manager: | ||
OTP_SECRET_KEY: npm/aws-crypto-tools-ci-bot/2FA:OTP_SECRET_KEY | ||
NPM_TOKEN: npm/aws-crypto-tools-ci-bot/2FA:NPM_TOKEN | ||
git-credential-helper: yes | ||
|
||
phases: | ||
install: | ||
commands: | ||
- npm ci --unsafe-perm | ||
# Install `otplib` to extract the OTP from the npm 2FA secret | ||
- npm install otplib --no-save | ||
- npm run build | ||
runtime-versions: | ||
nodejs: 10 | ||
pre_build: | ||
commands: | ||
- git config --global user.name "aws-crypto-tools-ci-bot" | ||
- git config --global user.email "[email protected]" | ||
- git checkout $BRANCH | ||
build: | ||
commands: | ||
# Pre-check, make sure everything is happy | ||
- npm test | ||
- npm run test_conditions | ||
- npm run verdaccio | ||
# Generate new version and CHANGELOG entry. Because we specify `--no-push` this | ||
# does not yet push any changes to the remote | ||
- npx lerna version --conventional-commits --git-remote origin --yes --no-push | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do want to push here |
||
# Log the commit for posterity | ||
- git log -n 1 | ||
# Publish to the local verdaccio server and run all tests | ||
- npm run verdaccio-publish | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is better tested at |
||
# Extract the otp using the secrets environment variables from above. | ||
# This will wait for the next token. This is because npm uses | ||
# TOTP and the tokens time out after 30 seconds. If the process just | ||
# extracted the token then the lifetime for this token | ||
# would be very random. This will maximize the amount of time | ||
# available on the OTP to publish. | ||
- >- | ||
OTP=`node -e " | ||
auth=require('otplib').authenticator; | ||
setTimeout(() => | ||
console.log(auth.generate(process.env.OTP_SECRET_KEY)), | ||
auth.timeRemaining() * 1000); | ||
"` | ||
# Now we publish to npm. | ||
# This is going to use the OTP generated above and the NPM_TOKEN | ||
# environment variable. This will only publish things that are | ||
# missing from npm. It is therefore safe to run repeatedly. | ||
- npx lerna publish from-package --yes --otp $OTP | ||
# Clear out the verdaccio cache so that we get the latest version | ||
# of everything from public npm | ||
- rm -rf verdaccio/storage/ | ||
# Since the cache is empty, and we don't call `verdaccio-publish` | ||
# this will run the integrations from the public code in npm | ||
- npx run-s verdaccio-publish-* | ||
|
||
|
||
# Batching is technically unnecessary for now since we have just the one | ||
# buildspec, but leaving it in place makes it easier to extend later on | ||
batch: | ||
fast-fail: true | ||
build-graph: | ||
- identifier: release_to_prod |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.