Skip to content

Commit

Permalink
Merge branch 'master' into feat/move_to_to_of_body
Browse files Browse the repository at this point in the history
  • Loading branch information
adamerickson-branch authored Nov 12, 2024
2 parents 2046623 + 9043225 commit d6027c2
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 56 deletions.
72 changes: 34 additions & 38 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -60,17 +53,26 @@ 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
run: |
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }}
- 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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ 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
- Updates qr image download to avoid errors
## [2.85.0] - 2024-04-10
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
8 changes: 4 additions & 4 deletions deployment/release.sh → deployment/release-s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ 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.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"

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
echo
Expand Down
3 changes: 2 additions & 1 deletion examples/example.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ <h4>QR Code</h4>
"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' ],
Expand Down
3 changes: 2 additions & 1 deletion src/0_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
3 changes: 2 additions & 1 deletion test/web-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit d6027c2

Please sign in to comment.