-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (70 loc) · 3.18 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: run tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
token_format: access_token
workload_identity_provider: projects/949875736540/locations/global/workloadIdentityPools/external-pool/providers/github-provider
service_account: [email protected]
- name: Login to GAR
uses: docker/login-action@v3
with:
registry: europe-west3-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- uses: hoverkraft-tech/[email protected]
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 23
- name: Install dependencies
run: |
npm install;
npm run build;
sudo apt-get install jq curl
- name: Run example
run: |
ACCOUNT_RESPONSE=$(curl -s --location "http://localhost:9000/v1/accounts" \
--header "Content-Type: application/json" \
--data-raw '{
"companyName": "demo",
"email": "[email protected]",
"password": "Password1234!"
}');
export TALON_USER_ID=$(echo $ACCOUNT_RESPONSE | jq ".userId");
export TALON_USER_TOKEN=$(echo $ACCOUNT_RESPONSE | jq ".token" | tr -d '"');
USER_RESPONSE=$(curl -s --location "http://localhost:9000/v1/users/$TALON_USER_ID" \
--header "Authorization: Bearer $TALON_USER_TOKEN");
export TALON_ACCOUNT_ID=$(echo $USER_RESPONSE | jq ".accountId");
echo "User with ID $TALON_USER_ID and Token $TALON_USER_TOKEN was created for application $TALON_ACCOUNT_ID";
APPLICATION_RESPONSE=$(curl -s --location "http://localhost:9000/v1/applications" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $TALON_USER_TOKEN" \
--data-raw '{
"name": "demo",
"currency": "EUR",
"timezone": "Europe/Berlin",
"enableFlattenedCartItems": false
}');
export TALON_APPLICATION_ID=$(echo $USER_RESPONSE | jq ".id");
echo "Application with ID $TALON_APPLICATION_ID was created"
API_KEY_RESPONSE=$(curl -s -v --location "http://localhost:9000/v1/applications/$TALON_APPLICATION_ID/apikeys" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $TALON_USER_TOKEN" \
--data-raw '{
"title": "Application HIT KEY",
"expires": "2099-01-01T0:00:00Z"
}');
echo "Api-Key-Response: $API_KEY_RESPONSE";
export TALON_API_KEY=$(echo $API_KEY_RESPONSE | jq ".key" | tr -d '"');
echo "Api-Key $TALON_API_KEY created"
node example.js;