44
55set -e
66
7+ read -p " Are we only doing the simplified GovCloud release? ONLY IF THE NORMAL RELEASE IS DONE AND YOU HAVE DOWNLOADED THE LAYERS (y/n)? " GOVCLOUD_ONLY
8+
79# Ensure on main, and pull the latest
810BRANCH=$( git rev-parse --abbrev-ref HEAD)
911if [ $BRANCH != " main" ]; then
3234fi
3335
3436# Ensure pypi registry access
35- read -p " Do you have access to PyPI (y/n)?" CONT
36- if [ " $CONT " != " y" ]; then
37- echo " Exiting"
38- exit 1
37+ if [ $GOVCLOUD_ONLY == " y" ]; then
38+ echo " Skipping PyPI check since this is a GovCloud-only release"
39+
40+ else
41+ read -p " Do you have access to PyPI (y/n)?" CONT
42+ if [ " $CONT " != " y" ]; then
43+ echo " Exiting"
44+ exit 1
45+ fi
3946fi
4047
4148CURRENT_VERSION=$( poetry version --short)
4249LAYER_VERSION=$( echo $NEW_VERSION | cut -d ' .' -f 2)
4350
44- read -p " Ready to update the library version from $CURRENT_VERSION to $NEW_VERSION and publish layer version $LAYER_VERSION (y/n)?" CONT
45- if [ " $CONT " != " y" ]; then
46- echo " Exiting"
47- exit 1
48- fi
51+ if [ $GOVCLOUD_ONLY == " y" ]; then
52+ echo " Skipping Libary Updates, code changes, layer builds and signing for GovCloud-only release"
4953
50- echo " Answer 'n' if already done in a PR"
51- read -p " Update pyproject.toml version? (y/n)?" CONT
52- if [ " $CONT " != " y" ]; then
53- echo " Skipping updating package.json version"
5454else
55- echo
56- echo " Replacing version in pyproject.toml and datadog_lambda/version.py"
57- echo
58-
59- poetry version ${NEW_VERSION}
60- echo " __version__ = \" ${NEW_VERSION} \" " > datadog_lambda/version.py
61- fi
62-
63- echo
64- echo " Building layers..."
65- ./scripts/build_layers.sh
55+ read -p " Ready to update the library version from $CURRENT_VERSION to $NEW_VERSION and publish layer version $LAYER_VERSION (y/n)?" CONT
56+ if [ " $CONT " != " y" ]; then
57+ echo " Exiting"
58+ exit 1
59+ fi
60+
61+ echo " Answer 'n' if already done in a PR"
62+ read -p " Update pyproject.toml version? (y/n)?" CONT
63+ if [ " $CONT " != " y" ]; then
64+ echo " Skipping updating package.json version"
65+ else
66+ echo
67+ echo " Replacing version in pyproject.toml and datadog_lambda/version.py"
68+ echo
69+
70+ poetry version ${NEW_VERSION}
71+ echo " __version__ = \" ${NEW_VERSION} \" " > datadog_lambda/version.py
72+ fi
6673
67- echo
68- echo " Signing layers for commercial AWS regions"
69- aws-vault exec sso-prod-engineering -- ./scripts/sign_layers.sh prod
70-
71- echo " Answer 'n' if GitLab already did this"
72- read -p " Deploy layers to commercial AWS (y/n)?" CONT
73- if [ " $CONT " != " y" ]; then
74- echo " Skipping deployment to commercial AWS"
75- else
76- echo " Ensuring you have access to the production AWS account"
77- aws-vault exec sso-prod-engineering -- aws sts get-caller-identity
74+ echo
75+ echo " Building layers..."
76+ ./scripts/build_layers.sh
7877
7978 echo
80- echo " Publishing layers to commercial AWS regions"
81- VERSION=$LAYER_VERSION aws-vault exec sso-prod-engineering --no-session -- ./scripts/publish_layers.sh
79+ echo " Signing layers for commercial AWS regions"
80+ aws-vault exec sso-prod-engineering -- ./scripts/sign_layers.sh prod
81+
82+ echo " Answer 'n' if GitLab already did this"
83+ read -p " Deploy layers to commercial AWS (y/n)?" CONT
84+ if [ " $CONT " != " y" ]; then
85+ echo " Skipping deployment to commercial AWS"
86+ else
87+ echo " Ensuring you have access to the production AWS account"
88+ aws-vault exec sso-prod-engineering -- aws sts get-caller-identity
89+
90+ echo
91+ echo " Publishing layers to commercial AWS regions"
92+ VERSION=$LAYER_VERSION aws-vault exec sso-prod-engineering --no-session -- ./scripts/publish_layers.sh
93+ fi
8294fi
95+
8396read -p " Deploy layers to GovCloud AWS (y/n)?" CONT
8497if [ " $CONT " != " y" ]; then
8598 echo " Skipping deployment to GovCloud AWS"
@@ -91,32 +104,37 @@ else
91104 VERSION=$LAYER_VERSION aws-vault exec sso-govcloud-us1-fed-engineering -- ./scripts/publish_layers.sh
92105fi
93106
94- echo " Answer 'n' if GitLab already did this"
95- read -p " Ready to publish $NEW_VERSION to PyPI (y/n)?" CONT
96- if [ " $CONT " != " y" ]; then
97- echo " Skipping publishing to PyPI"
98- else
99- echo
100- echo " Publishing to https://pypi.org/project/datadog-lambda/"
101- ./scripts/pypi.sh
102- fi
103-
107+ if [ $GOVCLOUD_ONLY == " y" ]; then
108+ echo " Skipping PyPI check and Github Release since this is a GovCloud-only release"
104109
105- echo " Answer 'n' if you already released in GitHub"
106- read -p " Do you want to bump the version in GitHub? (y/n)" CONT
107- if [ " $CONT " != " y" ]; then
108- echo " Skipping publishing updates to GitHub"
109110else
111+ echo " Answer 'n' if GitLab already did this"
112+ read -p " Ready to publish $NEW_VERSION to PyPI (y/n)?" CONT
113+ if [ " $CONT " != " y" ]; then
114+ echo " Skipping publishing to PyPI"
115+ else
116+ echo
117+ echo " Publishing to https://pypi.org/project/datadog-lambda/"
118+ ./scripts/pypi.sh
119+ fi
120+
121+
122+ echo " Answer 'n' if you already released in GitHub"
123+ read -p " Do you want to bump the version in GitHub? (y/n)" CONT
124+ if [ " $CONT " != " y" ]; then
125+ echo " Skipping publishing updates to GitHub"
126+ else
127+ echo
128+ echo ' Publishing updates to github'
129+ git commit pyproject.toml datadog_lambda/version.py -m " Bump version to ${NEW_VERSION} "
130+ git push origin main
131+ git tag " v$LAYER_VERSION "
132+ git push origin " refs/tags/v$LAYER_VERSION "
133+ fi
134+
110135 echo
111- echo ' Publishing updates to github'
112- git commit pyproject.toml datadog_lambda/version.py -m " Bump version to ${NEW_VERSION} "
113- git push origin main
114- git tag " v$LAYER_VERSION "
115- git push origin " refs/tags/v$LAYER_VERSION "
136+ echo " Now create a new release with the tag v${LAYER_VERSION} created unless you have done this already"
137+ echo " https://github.com/DataDog/datadog-lambda-python/releases/new?tag=v$LAYER_VERSION &title=v$LAYER_VERSION "
116138fi
117-
118- echo
119- echo " Now create a new release with the tag v${LAYER_VERSION} created unless you have done this already"
120- echo " https://github.com/DataDog/datadog-lambda-python/releases/new?tag=v$LAYER_VERSION &title=v$LAYER_VERSION "
121139# Open a PR to the documentation repo to automatically bump layer version
122140VERSION=$LAYER_VERSION LAYER=datadog-lambda-python ./scripts/create_documentation_pr.sh
0 commit comments