Skip to content

Commit 0700161

Browse files
committed
ci: add workflow to publish e2e-cli build to sdk-e2e-tests
On merge to master, builds the e2e-cli and pushes it to the cli-builds branch of sdk-e2e-tests for consumption by mme-e2e.
1 parent 33a8fe2 commit 0700161

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Publish E2E CLI build to sdk-e2e-tests cli-builds branch
2+
#
3+
# On merge to master, builds the e2e-cli and pushes it
4+
# to the cli-builds branch of sdk-e2e-tests.
5+
6+
name: Publish E2E CLI
7+
8+
on:
9+
push:
10+
branches: [master]
11+
paths:
12+
- 'e2e-cli/**'
13+
- 'packages/core/src/**'
14+
workflow_dispatch:
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout SDK
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
28+
- name: Build e2e-cli
29+
working-directory: e2e-cli
30+
run: |
31+
npm install
32+
npm run build
33+
34+
- name: Checkout sdk-e2e-tests (cli-builds branch)
35+
uses: actions/checkout@v4
36+
with:
37+
repository: segmentio/sdk-e2e-tests
38+
ref: cli-builds
39+
token: ${{ secrets.E2E_TESTS_TOKEN }}
40+
path: sdk-e2e-tests-builds
41+
fetch-depth: 1
42+
43+
- name: Copy CLI artifacts
44+
run: |
45+
rm -rf sdk-e2e-tests-builds/analytics-react-native
46+
mkdir -p sdk-e2e-tests-builds/analytics-react-native
47+
cp -r e2e-cli/dist sdk-e2e-tests-builds/analytics-react-native/
48+
cp e2e-cli/package.json sdk-e2e-tests-builds/analytics-react-native/
49+
50+
- name: Push to cli-builds branch
51+
working-directory: sdk-e2e-tests-builds
52+
run: |
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add -A
56+
if git diff --cached --quiet; then
57+
echo "No changes to CLI build"
58+
else
59+
git commit -m "update analytics-react-native CLI build (${GITHUB_SHA::8})"
60+
git push
61+
fi

0 commit comments

Comments
 (0)