From 441102e3a0657ea4f5c7b59dbf9c3b48e348aabc Mon Sep 17 00:00:00 2001 From: Brice Redmond Date: Mon, 11 Nov 2024 12:07:04 -0800 Subject: [PATCH 1/4] [patch] fix release.sh (#1087) # Pull Request Template ## Description 2 problems: - the s3 publishes should not have had acl (i got this from what was there before) - the npm publish needs a valid token Fixes # (issue) ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Unit test - [ ] Integration test ## JS Budget Check Please mention the size in kb before abd after this PR | Files | Before | After | | ----------- | ----------- | ----------- | | dist/build.js. | | | | dist/build.min.js| | | ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules - [ ] I have checked my code and corrected any misspellings ## Mentions: List the person or team responsible for reviewing proposed changes. cc @BranchMetrics/saas-sdk-devs for visibility. --- .github/workflows/build-push.yml | 72 +++++++++++------------- .github/workflows/deploy-release.yml | 11 +++- deployment/{release.sh => release-s3.sh} | 6 +- 3 files changed, 46 insertions(+), 43 deletions(-) rename deployment/{release.sh => release-s3.sh} (91%) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index be4cf724..b2f3b99a 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -25,6 +25,40 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Install branch-github-actions + uses: actions/checkout@v4 + with: + repository: BranchMetrics/branch-github-actions + ref: master + path: .branch-github-actions + token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }} + + - name: Add INPUT_SHA env var + run: | + export INPUT_SHA=$(git rev-parse ${{ github.ref }}) + echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV + + - name: Get next release version + uses: actions/github-script@v7 + id: next-version + with: + result-encoding: string + script: | + const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version'); + const nextVersion = await getNextVersion({ + core, + github, + context, + sha: process.env.INPUT_SHA, + }); + return nextVersion; + env: + INPUT_SHA: ${{ env.INPUT_SHA }} + + - name: Write version to files + run: | + ./deployment/write-versions.sh ${{ steps.next-version.outputs.result }} + - name: Install dependencies run: npm run ci @@ -67,44 +101,6 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - name: Install branch-github-actions - if: ${{ github.ref == 'refs/heads/master' }} - uses: actions/checkout@v4 - with: - repository: BranchMetrics/branch-github-actions - ref: master - path: .branch-github-actions - token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }} - - - name: Add INPUT_SHA env var - if: ${{ github.ref == 'refs/heads/master' }} - run: | - export INPUT_SHA=$(git rev-parse ${{ github.ref }}) - echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV - - - name: Get next release version - if: ${{ github.ref == 'refs/heads/master' }} - uses: actions/github-script@v7 - id: next-version - with: - result-encoding: string - script: | - const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version'); - const nextVersion = await getNextVersion({ - core, - github, - context, - sha: process.env.INPUT_SHA, - }); - return nextVersion; - env: - INPUT_SHA: ${{ env.INPUT_SHA }} - - - name: Write version to files - if: ${{ github.ref == 'refs/heads/master' }} - run: | - ./deployment/write-versions.sh ${{ steps.next-version.outputs.result }} - - name: Deploy updated builds to staging if: ${{ github.ref == 'refs/heads/master' }} id: build diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 928aeb79..eed558d5 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -68,9 +68,16 @@ jobs: - name: Configure NPM run: npm ci - - name: Release to npm, s3, prod + - run: make release + + - name: Publish to s3 run: | - ./deployment/release.sh ${{ steps.next-version.outputs.result }} + ./deployment/release-s3.sh ${{ steps.next-version.outputs.result }} + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }} + run: npm publish - name: Create Github Release uses: actions/github-script@v7 diff --git a/deployment/release.sh b/deployment/release-s3.sh similarity index 91% rename from deployment/release.sh rename to deployment/release-s3.sh index 0922cb58..68de6b43 100755 --- a/deployment/release.sh +++ b/deployment/release-s3.sh @@ -12,15 +12,15 @@ make release ./deployment/build-example-html.sh "key_live_hcnegAumkH7Kv18M8AOHhfgiohpXq5tB" "https://api2.branch.io" "https://cdn.branch.io/branch-latest.min.js" aws s3 cp example.html s3://branch-builds/example.html +aws s3 cp example.html s3://branch-cdn/example.html -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 -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 +aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-$VERSION.min.js --cache-control "max-age=300" +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" echo -en "Invalidating cloudfront distribution...\n" aws configure set preview.cloudfront true aws cloudfront create-invalidation --distribution-id E10P37NG0GMER --paths /branch-latest.min.js -npm publish echo "Post-release sanity checks." read -p "Can you visit https://cdn.branch.io/branch-$VERSION.min.js ?" -n 1 -r From acba1f964162f1cf25b2911c9710eb295eb13b4b Mon Sep 17 00:00:00 2001 From: Brice Redmond Date: Mon, 11 Nov 2024 14:10:10 -0800 Subject: [PATCH 2/4] [other] a couple more deploy cleanups (#1089) # Pull Request Template ## Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Unit test - [ ] Integration test ## JS Budget Check Please mention the size in kb before abd after this PR | Files | Before | After | | ----------- | ----------- | ----------- | | dist/build.js. | | | | dist/build.min.js| | | ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules - [ ] I have checked my code and corrected any misspellings ## Mentions: List the person or team responsible for reviewing proposed changes. cc @BranchMetrics/saas-sdk-devs for visibility. --- .github/workflows/deploy-release.yml | 1 + CHANGELOG.md | 2 ++ Makefile | 1 - deployment/release-s3.sh | 2 +- examples/example.template.html | 3 ++- src/0_config.js | 3 ++- test/web-config.js | 3 ++- 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index eed558d5..48a54fd1 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -61,6 +61,7 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} + # Do this before npm configure because it writes the package.json version - name: Write version to files run: | ./deployment/write-versions.sh ${{ steps.next-version.outputs.result }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2df8413b..a276ef92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to the Branch Web SDK will be documented here. The Branch Web SDK adheres to [Semantic Versioning](http://semver.org/). ## [VERSION] - unreleased +## [2.85.2] - 2024-11-11 +- Updates release process ## [2.85.1] - 2024-11-04 - Updates qr image download to avoid errors ## [2.85.0] - 2024-04-10 diff --git a/Makefile b/Makefile index 65e8ce5b..0321a8b1 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,6 @@ all: dist/build.min.js dist/build.js test/branch-deps.js test/integration-test.h clean: rm -f dist/** docs/web/3_branch_web.md test/branch-deps.js dist/build.min.js.gz test/integration-test.html release: clean all dist/build.min.js.gz - @echo "released" test/branch-deps.js: $(SOURCES) npx closure-make-deps \ diff --git a/deployment/release-s3.sh b/deployment/release-s3.sh index 68de6b43..e1937a37 100755 --- a/deployment/release-s3.sh +++ b/deployment/release-s3.sh @@ -14,6 +14,7 @@ make release aws s3 cp example.html s3://branch-builds/example.html aws s3 cp example.html s3://branch-cdn/example.html +aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.js s3://branch-cdn/branch-latest.js --cache-control "max-age=300" aws s3 cp --content-type="text/javascript" --content-encoding="gzip" dist/build.min.js.gz s3://branch-cdn/branch-$VERSION.min.js --cache-control "max-age=300" 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" @@ -21,7 +22,6 @@ echo -en "Invalidating cloudfront distribution...\n" aws configure set preview.cloudfront true aws cloudfront create-invalidation --distribution-id E10P37NG0GMER --paths /branch-latest.min.js - echo "Post-release sanity checks." read -p "Can you visit https://cdn.branch.io/branch-$VERSION.min.js ?" -n 1 -r echo diff --git a/examples/example.template.html b/examples/example.template.html index 34fe4c29..d00795ec 100644 --- a/examples/example.template.html +++ b/examples/example.template.html @@ -250,7 +250,8 @@

QR Code

"background_color": "#FFFFFF", "margin": 5, "width": 1000, - "image_format": "png" + "image_format": "png", + "center_logo_url": "https://branch-assets.s3.us-west-1.amazonaws.com/branch-badge-dark.svg", }; var qrCodeParams = { tags: [ 'tag1', 'tag2' ], diff --git a/src/0_config.js b/src/0_config.js index 70262e48..12e7d959 100644 --- a/src/0_config.js +++ b/src/0_config.js @@ -8,4 +8,5 @@ var DEFAULT_API_ENDPOINT = 'https://api2.branch.io'; config.app_service_endpoint = 'https://app.link'; config.link_service_endpoint = 'https://bnc.lt'; config.api_endpoint = DEFAULT_API_ENDPOINT; -config.version = '2.85.1'; // will get overwritten by gha on actual deploy +// will get overwritten by gha on actual deploy +config.version = '2.85.2'; diff --git a/test/web-config.js b/test/web-config.js index 9636fd6c..0f5d97b1 100644 --- a/test/web-config.js +++ b/test/web-config.js @@ -6,4 +6,5 @@ goog.provide('config'); config.app_service_endpoint = 'https://app.link'; config.link_service_endpoint = 'https://bnc.lt'; config.api_endpoint = 'https://api.branch.io'; -config.version = '2.85.1'; // will get overwritten by gha on actual deploy +// will get overwritten by gha on actual deploy +config.version = '2.85.2'; From 11319384eaad26ddf5ae056d2cecbbed5f363854 Mon Sep 17 00:00:00 2001 From: Brice Redmond Date: Mon, 11 Nov 2024 14:57:38 -0800 Subject: [PATCH 3/4] [patch] try logging into npm (#1090) # Pull Request Template ## Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Unit test - [ ] Integration test ## JS Budget Check Please mention the size in kb before abd after this PR | Files | Before | After | | ----------- | ----------- | ----------- | | dist/build.js. | | | | dist/build.min.js| | | ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules - [ ] I have checked my code and corrected any misspellings ## Mentions: List the person or team responsible for reviewing proposed changes. cc @BranchMetrics/saas-sdk-devs for visibility. --- .github/workflows/deploy-release.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 48a54fd1..cab3b473 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -2,11 +2,6 @@ name: Publish Next Release (Manual) on: workflow_dispatch: - inputs: - ref: - description: Reference git commit to release (e.g. "master", "12341fa") - required: true - default: master env: NODE_VERSION: 18 @@ -16,8 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.ref }} - name: AWS, credentials setup uses: aws-actions/configure-aws-credentials@v4 @@ -28,7 +21,7 @@ jobs: - name: Add INPUT_SHA env var run: | - export INPUT_SHA=$(git rev-parse ${{ github.event.inputs.ref }}) + export INPUT_SHA=$(git rev-parse ${{ github.ref }}) echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV - name: Install branch-github-actions @@ -60,6 +53,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + registry-url: 'https://registry.npmjs.org' # Do this before npm configure because it writes the package.json version - name: Write version to files From 904322593218f2426a19827c75e2a01d48f70d76 Mon Sep 17 00:00:00 2001 From: Brice Redmond Date: Mon, 11 Nov 2024 15:15:23 -0800 Subject: [PATCH 4/4] [other] update changelog (#1091) # Pull Request Template ## Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Unit test - [ ] Integration test ## JS Budget Check Please mention the size in kb before abd after this PR | Files | Before | After | | ----------- | ----------- | ----------- | | dist/build.js. | | | | dist/build.min.js| | | ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules - [ ] I have checked my code and corrected any misspellings ## Mentions: List the person or team responsible for reviewing proposed changes. cc @BranchMetrics/saas-sdk-devs for visibility. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a276ef92..57a72d4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to the Branch Web SDK will be documented here. The Branch Web SDK adheres to [Semantic Versioning](http://semver.org/). ## [VERSION] - unreleased +## [2.85.4] - 2024-11-11 +- updates release process ## [2.85.2] - 2024-11-11 - Updates release process ## [2.85.1] - 2024-11-04