Skip to content

Commit 441102e

Browse files
authored
[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.
1 parent 15c30fa commit 441102e

File tree

3 files changed

+46
-43
lines changed

3 files changed

+46
-43
lines changed

.github/workflows/build-push.yml

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,40 @@ jobs:
2525
java-version: ${{ env.JAVA_VERSION }}
2626
distribution: ${{ env.JAVA_DISTRIBUTION }}
2727

28+
- name: Install branch-github-actions
29+
uses: actions/checkout@v4
30+
with:
31+
repository: BranchMetrics/branch-github-actions
32+
ref: master
33+
path: .branch-github-actions
34+
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
35+
36+
- name: Add INPUT_SHA env var
37+
run: |
38+
export INPUT_SHA=$(git rev-parse ${{ github.ref }})
39+
echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV
40+
41+
- name: Get next release version
42+
uses: actions/github-script@v7
43+
id: next-version
44+
with:
45+
result-encoding: string
46+
script: |
47+
const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version');
48+
const nextVersion = await getNextVersion({
49+
core,
50+
github,
51+
context,
52+
sha: process.env.INPUT_SHA,
53+
});
54+
return nextVersion;
55+
env:
56+
INPUT_SHA: ${{ env.INPUT_SHA }}
57+
58+
- name: Write version to files
59+
run: |
60+
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }}
61+
2862
- name: Install dependencies
2963
run: npm run ci
3064

@@ -67,44 +101,6 @@ jobs:
67101
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
68102
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69103

70-
- name: Install branch-github-actions
71-
if: ${{ github.ref == 'refs/heads/master' }}
72-
uses: actions/checkout@v4
73-
with:
74-
repository: BranchMetrics/branch-github-actions
75-
ref: master
76-
path: .branch-github-actions
77-
token: ${{ secrets.BRANCHLET_ACCESS_TOKEN_PUBLIC }}
78-
79-
- name: Add INPUT_SHA env var
80-
if: ${{ github.ref == 'refs/heads/master' }}
81-
run: |
82-
export INPUT_SHA=$(git rev-parse ${{ github.ref }})
83-
echo "INPUT_SHA=`echo $INPUT_SHA`" >> $GITHUB_ENV
84-
85-
- name: Get next release version
86-
if: ${{ github.ref == 'refs/heads/master' }}
87-
uses: actions/github-script@v7
88-
id: next-version
89-
with:
90-
result-encoding: string
91-
script: |
92-
const getNextVersion = require('./.branch-github-actions/custom-scripts/next-version');
93-
const nextVersion = await getNextVersion({
94-
core,
95-
github,
96-
context,
97-
sha: process.env.INPUT_SHA,
98-
});
99-
return nextVersion;
100-
env:
101-
INPUT_SHA: ${{ env.INPUT_SHA }}
102-
103-
- name: Write version to files
104-
if: ${{ github.ref == 'refs/heads/master' }}
105-
run: |
106-
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }}
107-
108104
- name: Deploy updated builds to staging
109105
if: ${{ github.ref == 'refs/heads/master' }}
110106
id: build

.github/workflows/deploy-release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ jobs:
6868
- name: Configure NPM
6969
run: npm ci
7070

71-
- name: Release to npm, s3, prod
71+
- run: make release
72+
73+
- name: Publish to s3
7274
run: |
73-
./deployment/release.sh ${{ steps.next-version.outputs.result }}
75+
./deployment/release-s3.sh ${{ steps.next-version.outputs.result }}
76+
77+
- name: Publish to npm
78+
env:
79+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }}
80+
run: npm publish
7481

7582
- name: Create Github Release
7683
uses: actions/github-script@v7

deployment/release.sh renamed to deployment/release-s3.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ make release
1212

1313
./deployment/build-example-html.sh "key_live_hcnegAumkH7Kv18M8AOHhfgiohpXq5tB" "https://api2.branch.io" "https://cdn.branch.io/branch-latest.min.js"
1414
aws s3 cp example.html s3://branch-builds/example.html
15+
aws s3 cp example.html s3://branch-cdn/example.html
1516

16-
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
17-
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
17+
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"
18+
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"
1819

1920
echo -en "Invalidating cloudfront distribution...\n"
2021
aws configure set preview.cloudfront true
2122
aws cloudfront create-invalidation --distribution-id E10P37NG0GMER --paths /branch-latest.min.js
2223

23-
npm publish
2424

2525
echo "Post-release sanity checks."
2626
read -p "Can you visit https://cdn.branch.io/branch-$VERSION.min.js ?" -n 1 -r

0 commit comments

Comments
 (0)