Skip to content
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

web sdk release script #286

Merged
merged 3 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions firestore-stripe-web-sdk/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

set -Eeuo pipefail

GREEN=$(tput setaf 2)
RED=$(tput setaf 1)
RED_BG=$(tput setab 1)
YELLOW=$(tput setaf 3)
RESET=$(tput sgr 0)
BOLD=$(tput bold)

# verify we meant to run this script
read -r -n 1 -p "${YELLOW}WARNING:${RESET} running this script deploys changes publicly. Are you sure you want to continue? [y/n] "
echo
echo
if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then exit 1; fi

# verify the user has required permissions
read -r -n 1 -p "Do you have a stripe npm account with 2FA? [y/n] "
echo
echo
if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then
echo "${RED}ERROR:${RESET} Please create a stripe npm account to continue"
exit 1
fi

version=$(nodenv version | cut -d . -f 1)
if [ ! "${version}" -gt "12" ]; then
echo "${RED}ERROR:${RESET} must have node version 12 or greater"
echo "current version is ${YELLOW}$(nodenv version | cut -d ' ' -f 1)${RESET}"
echo
echo "set new node version with ${BOLD}nodenv shell 14.7.0${RESET} or any other installed version 12 or greater to continue"
exit 1
fi
echo "${GREEN}SUCCESS:${RESET} your current node version is 12 or greater (${GREEN}$(nodenv version | cut -d ' ' -f 1)${RESET})"
echo

if ! npm team ls @stripe:developers &> /dev/null; then
echo "Please login to your stripe npm account"
npm login
fi

while ! npm team ls @stripe:developers &> /dev/null;
do
echo
echo "${RED}ERROR:${RESET} either you haven't logged into your stripe npm account or your account doesn't belong to the stripe org"
echo
echo "${RED_BG}verify${RESET} that you are logged in to your stripe npm account by running ${BOLD}npm whoami${RESET}"
echo "${BOLD}npm whoami${RESET} should return ${GREEN}$USER-stripe${RESET}"
current_npm_user=$(npm whoami)
echo "${BOLD}npm whoami${RESET} currently returns ${RED}$current_npm_user${RESET}"
echo
echo "${RED_BG}verify${RESET} that you belong to the stripe org by checking your listed organizations at ${BOLD}https://npmjs.com/~$USER-stripe${RESET}"
echo "if you don't belong to the stripe org, be sure to ping ${BOLD}#payments-web${RESET}"
echo
read -r -n 1 -p "Do you want to try again? [y/n] "
echo
if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then exit 1; fi
echo
echo "Please login to your stripe npm account"
npm login
done

echo
echo "${GREEN}SUCCESS:${RESET} you are logged into your stripe npm account"
echo

# build the release artifact
if ! npm run test; then
echo
echo "${RED}ERROR:${RESET} some tests have failed, please fix them to continue"
exit 1
fi

echo
echo "${GREEN}SUCCESS:${RESET} all tests have passed"
echo

if ! rm stripe-firestore-stripe-payments-*.tgz; then
echo
echo "${RED}ERROR:${RESET} encountered an error removing old release artifacts"
exit 1
fi

if ! npm run build; then
echo
echo "${RED}ERROR:${RESET} encountered an error while building the release artifact"
exit 1
fi

if ! npm pack; then
echo
echo "${RED}ERROR:${RESET} encountered an error while building the release artifact"
exit 1
fi

echo
echo "${GREEN}SUCCESS:${RESET} built the release artifact"
echo

read -r -n 1 -p "Did you notify #developer-products and #developer-advocacy about this release? [y/n] "
echo
echo
if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then
echo "${RED}ERROR:${RESET} Please notify #developer-products and #developer-advocacy before any release"
exit 1
fi

# publish
if ! npm publish stripe-firestore-stripe-payments-*.tgz --access restricted; then
echo
echo "${RED}ERROR:${RESET} encountered an error while publishing new version"
exit 1
fi

echo "${GREEN}SUCCESS:${RESET} published the new version!"
12 changes: 6 additions & 6 deletions firestore-stripe-web-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stripe/firestore-stripe-payments",
"version": "0.0.1",
"version": "0.0.2",
"description": "Client SDK for the firestore-stripe-payments Firebase Extension",
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
Expand Down Expand Up @@ -31,13 +31,13 @@
"README.md"
],
"devDependencies": {
"@microsoft/api-documenter": "^7.13.63",
"@microsoft/api-extractor": "^7.18.7",
"@microsoft/api-documenter": "^7.13.65",
"@microsoft/api-extractor": "^7.18.17",
"@types/chai": "^4.2.21",
"@types/chai-as-promised": "^7.1.4",
"@types/chai-like": "^1.1.1",
"@types/mocha": "^9.0.0",
"@types/sinon": "^10.0.2",
"@types/sinon": "^10.0.6",
"@types/sinon-chai": "^3.2.5",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
Expand All @@ -60,8 +60,8 @@
"typescript": "^4.4.2"
},
"dependencies": {
"@firebase/app": "^0.7.0",
"@firebase/app": "^0.7.5",
"@firebase/auth": "^0.17.2",
"@firebase/firestore": "^3.0.1"
"@firebase/firestore": "^3.2.0"
}
}