Skip to content

Commit 39fbda1

Browse files
committed
[other] add gha for release
Uses the github release as the source of truth. Updates the package.json and various configs with the proper version. This means that the new versions will not be checked into the repo, but they will be deployed properly. I am not sure if that is problematic
1 parent bb49881 commit 39fbda1

File tree

7 files changed

+22
-131
lines changed

7 files changed

+22
-131
lines changed

.github/workflows/build-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: upload codecov
5757
uses: codecov/codecov-action@v4
5858

59-
- name: check in whether updated build files are checked in
59+
- name: check whether updated build files are checked in
6060
run: |
6161
make
6262
git diff --exit-code || (echo "Please run \"make\" and commit changes to dist/build.js and dist/build.min.js" && exit 1)

.github/workflows/deploy-release.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
INPUT_SHA: ${{ env.INPUT_SHA }}
5858

5959
- name: Install Node ${{ env.NODE_VERSION }}
60-
uses: actions/setup-node@v3
60+
uses: actions/setup-node@v4
6161
with:
6262
node-version: ${{ env.NODE_VERSION }}
6363

@@ -70,16 +70,9 @@ jobs:
7070
- name: Configure NPM
7171
run: npm ci
7272

73-
- name: Publish to NPM
74-
run: npm publish
75-
76-
- name: Publish to s3
73+
- name: Release to npm, s3
7774
run: |
78-
make release
79-
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-latest.min.js --cache-control "max-age=300"
80-
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-latest-${{ steps.next-version.outputs.result }}.min.js --cache-control "max-age=300"
81-
aws configure set preview.cloudfront true
82-
aws cloudfront create-invalidation --distribution-id E10P37NG0GMER --paths /branch-latest.min.js
75+
./release.sh v${{ steps.next-version.outputs.result }}
8376
8477
- name: Create Github Release
8578
uses: actions/github-script@v7

deployment/deploy-qa.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ NC='\033[0m'
2424
./deployment/build-example-html.sh "key_live_feebgAAhbH9Tv85H5wLQhpdaefiZv5Dv" "https://api.stage.branch.io" "https://cdn.branch.io/branch-staging-latest.min.js"
2525
aws s3 cp example.html s3://branch-cdn/example-staging.html
2626

27-
./deployment/build-example-html.sh "key_live_hcnegAumkH7Kv18M8AOHhfgiohpXq5tB" "https://api2.branch.io" "https://cdn.branch.io/branch-latest.min.js"
28-
aws s3 cp example.html s3://branch-builds/web-sdk/example.html
29-
3027
echo -en "${GREEN}Pushing to CDN ...${NC}\n"
3128
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-staging-latest.min.js --cache-control "max-age=300"
3229

dist/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ var config = {}, DEFAULT_API_ENDPOINT = "https://api2.branch.io";
10751075
config.app_service_endpoint = "https://app.link";
10761076
config.link_service_endpoint = "https://bnc.lt";
10771077
config.api_endpoint = DEFAULT_API_ENDPOINT;
1078-
config.version = "2.84.0";
1078+
config.version = "2.85.1";
10791079
// Input 3
10801080
var safejson = {parse:function(a) {
10811081
a = String(a);

dist/build.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release.sh

Lines changed: 11 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -27,126 +27,27 @@ check_git_branch() {
2727

2828
check_git_branch
2929

30-
# update to the latest
31-
git pull origin master
32-
33-
read -p "Update CHANGELOG.md?" -n 1 -r
34-
echo
35-
if [[ $REPLY =~ ^[Yy]$ ]]
36-
then
37-
vi CHANGELOG.md
38-
git commit -am "Updated CHANGELOG.md"
39-
fi
40-
41-
echo "Building files"
42-
43-
read -p "Update 0_config.js? " -n 1 -r
44-
echo
45-
if [[ $REPLY =~ ^[Yy]$ ]]
46-
then
47-
sed -i -e "s/version = '.*';$/version = '$VERSION_NO_V';/" src/0_config.js
48-
sed -i -e "s/version = '.*';$/version = '$VERSION_NO_V';/" test/web-config.js
49-
fi
50-
51-
read -p "Update package.json? " -n 1 -r
52-
echo
53-
if [[ $REPLY =~ ^[Yy]$ ]]
54-
then
55-
sed -i -e "s/\"version\":.*$/\"version\": \"$VERSION_NO_V\",/" package.json
56-
sed -i -e "s/\"build\":.*$/\"build\": \"$VERSION_NO_V\"/" package.json
57-
fi
58-
59-
read -p "Bump CHANGELOG version? " -n 1 -r
60-
echo
61-
if [[ $REPLY =~ ^[Yy]$ ]]
62-
then
63-
sed -i -e "s/## \[VERSION\] - unreleased/## [$VERSION] - $DATE/" CHANGELOG.md
64-
fi
65-
66-
read -p "Update bower.json? " -n 1 -r
67-
echo
68-
if [[ $REPLY =~ ^[Yy]$ ]]
69-
then
70-
sed -i -e "s/\"version\":.*$/\"version\": \"$VERSION_NO_V\",/" bower.json
71-
sed -i -e "s/\"build\":.*$/\"build\": \"$VERSION_NO_V\"/" bower.json
72-
fi
30+
sed -i -e "s/version = '.*';$/version = '$VERSION_NO_V';/" src/0_config.js
31+
sed -i -e "s/version = '.*';$/version = '$VERSION_NO_V';/" test/web-config.js
7332

7433
make release
7534

76-
read -p "Commit? " -n 1 -r
77-
echo
78-
if [[ $REPLY =~ ^[Yy]$ ]]
79-
then
80-
git add dist/build.min.js.gz
81-
git commit -am "Tagging release $VERSION"
82-
check_git_branch
83-
fi
84-
85-
read -p "Tag? " -n 1 -r
86-
echo
87-
if [[ $REPLY =~ ^[Yy]$ ]]
88-
then
89-
git tag $VERSION
90-
fi
91-
92-
read -p "Copy to S3? " -n 1 -r
93-
echo
94-
if [[ $REPLY =~ ^[Yy]$ ]]
95-
then
96-
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-$VERSION.min.js --acl public-read
97-
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-latest.min.js --acl public-read
98-
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-v2.0.0.min.js --acl public-read
99-
aws s3 cp example.html s3://branch-cdn/example.html --acl public-read
100-
fi
35+
./deployment/build-example-html.sh "key_live_hcnegAumkH7Kv18M8AOHhfgiohpXq5tB" "https://api2.branch.io" "https://cdn.branch.io/branch-latest.min.js"
36+
aws s3 cp example.html s3://branch-builds/example.html
10137

102-
read -p "Publish to NPM? " -n 1 -r
103-
echo
104-
if [[ $REPLY =~ ^[Yy]$ ]]
105-
then
106-
npm publish
107-
fi
38+
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-$VERSION.min.js --acl public-read
39+
aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-latest.min.js --acl public-read
10840

109-
read -p "Reset? " -n 1 -r
110-
echo
111-
if [[ $REPLY =~ ^[Yy]$ ]]
112-
then
113-
perl -i -pe '$_ = "\n## [VERSION] - unreleased\n\n" if $. ==4' CHANGELOG.md
114-
make clean
115-
make
116-
git commit -am "Resetting to HEAD"
117-
fi
41+
echo -en "Invalidating cloudfront distribution...\n"
42+
aws configure set preview.cloudfront true
43+
aws cloudfront create-invalidation --distribution-id E10P37NG0GMER --paths /branch-latest.min.js
11844

119-
read -p "Clean up -e backup files?" -n 1 -r
120-
echo
121-
if [[ $REPLY =~ ^[Yy]$ ]]
122-
then
123-
rm -f bower.json-e CHANGELOG.md-e package.json-e src/0_config.js-e test/web-config.js-e
124-
fi
125-
126-
echo "Done script."
127-
read -p "Have you updated the javascript version in https://github.com/BranchMetrics/documentation/edit/master/ingredients/web_sdk/_initialization.md ?" -n 1 -r
128-
echo
45+
npm publish
12946

13047
echo "Post-release sanity checks."
13148
read -p "Can you visit https://cdn.branch.io/branch-$VERSION.min.js ?" -n 1 -r
13249
echo
13350
read -p "Is https://cdn.branch.io/example.html using the right version number $VERSION?" -n 1 -r
13451
echo
13552
read -p "Is https://www.npmjs.com/package/branch-sdk using the right version number $VERSION?" -n 1 -r
136-
echo
137-
138-
echo
139-
if [[ $REPLY =~ ^[Yy]$ ]]
140-
then
141-
echo "Ok"
142-
fi
143-
144-
echo "Last step, run:"
145-
echo " git push; git push origin $VERSION"
146-
147-
echo
148-
echo "Remember to check https://github.com/BranchMetrics/Smart-App-Banner-Deep-Linking-Web-SDK/tree/$VERSION/CHANGELOG.md "
149-
echo
150-
echo "Remember to ping @jed on slack about this release "
151-
152-
echo
53+
echo

0 commit comments

Comments
 (0)