Skip to content

Commit f770ade

Browse files
committed
update to make staging and prod sync
1 parent 39fbda1 commit f770ade

File tree

9 files changed

+35
-3501
lines changed

9 files changed

+35
-3501
lines changed

.github/workflows/build-push.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ jobs:
5656
- name: upload codecov
5757
uses: codecov/codecov-action@v4
5858

59-
- name: check whether updated build files are checked in
60-
run: |
61-
make
62-
git diff --exit-code || (echo "Please run \"make\" and commit changes to dist/build.js and dist/build.min.js" && exit 1)
63-
6459
- name: Check whether we will be able to make the release
6560
run: make release
6661

@@ -72,6 +67,19 @@ jobs:
7267
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
7368
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7469

70+
- name: Get the current release version
71+
if: ${{ github.ref == 'refs/heads/master' }}
72+
id: current-version
73+
run: |
74+
current_version=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
75+
echo "Current version is $current_version"
76+
echo "result=$current_version" >> $GITHUB_OUTPUT
77+
78+
- name: Write version to files
79+
if: ${{ github.ref == 'refs/heads/master' }}
80+
run: |
81+
./deployment/write-versions.sh ${{ steps.current-version.outputs.result }}
82+
7583
- name: Deploy updated builds to staging
7684
if: ${{ github.ref == 'refs/heads/master' }}
7785
id: build

.github/workflows/deploy-release.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,21 @@ jobs:
6161
with:
6262
node-version: ${{ env.NODE_VERSION }}
6363

64-
- name: Bump package.json version
64+
- name: Write version to files
6565
run: |
66-
sed -i -e "s/\"version\":.*$/\"version\": \"$GE_NEXT_VERSION\",/" package.json
67-
env:
68-
GE_NEXT_VERSION: ${{ steps.next-version.outputs.result }}
66+
./deployment/write-versions.sh ${{ steps.next-version.outputs.result }}
6967
7068
- name: Configure NPM
7169
run: npm ci
7270

73-
- name: Release to npm, s3
71+
- name: Release to npm, s3, prod
72+
run: |
73+
./deployment/release.sh ${{ steps.next-version.outputs.result }}
74+
75+
# We deploy to stage to send the updated release numbers. The code should not be any different
76+
- name: Release to stage
7477
run: |
75-
./release.sh v${{ steps.next-version.outputs.result }}
78+
./deployment/deploy-qa.sh ${{ steps.next-version.outputs.result }}
7679
7780
- name: Create Github Release
7881
uses: actions/github-script@v7

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ test-results.json
3939
.direnv/
4040
dev.config
4141
dev.html
42-
example.html
42+
example.html
43+
dist/

release.sh renamed to deployment/release.sh

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,13 @@
11
#!/bin/bash
22

3-
[ $# -eq 0 ] && { echo "Usage: $0 v1.0.0"; exit 1; }
3+
[ $# -eq 0 ] && { echo "Usage: $0 1.0.0"; exit 1; }
44

5-
VERSION_NO_V=$(echo $1 | tr -d "\nv")
5+
VERSION_NO_V=$1
66
VERSION="v"$VERSION_NO_V
77
DATE=$(date "+%Y-%m-%d")
88

99
echo "Releasing Branch Web SDK"
1010

11-
# check whether on master branch
12-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
13-
branch_name=${branch_name##refs/heads/}
14-
if [ $branch_name != "master" ]; then
15-
echo "ERROR: not on master branch: "$branch_name
16-
exit 1
17-
fi
18-
19-
# check whether the branch is clean
20-
check_git_branch() {
21-
if [[ $(git status --porcelain 2> /dev/null | tail -n1) != "" ]]
22-
then
23-
echo 'ERROR: branch dirty'
24-
exit 1
25-
fi
26-
}
27-
28-
check_git_branch
29-
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
32-
3311
make release
3412

3513
./deployment/build-example-html.sh "key_live_hcnegAumkH7Kv18M8AOHhfgiohpXq5tB" "https://api2.branch.io" "https://cdn.branch.io/branch-latest.min.js"

deployment/write-versions.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
[ $# -eq 0 ] && { echo "Usage: $0 1.0.0"; exit 1; }
4+
5+
sed -i -e "s/\"version\":.*$/\"version\": \"$1\",/" package.json
6+
sed -i -e "s/version = '.*';$/version = '$1';/" src/0_config.js
7+
sed -i -e "s/version = '.*';$/version = '$1';/" test/web-config.js

0 commit comments

Comments
 (0)