File tree 1 file changed +25
-3
lines changed
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -2,20 +2,42 @@ name: Deploy to Cloudflare
2
2
3
3
on :
4
4
push :
5
- branches : [main]
5
+ branches :
6
+ - main
7
+ - staging
8
+ pull_request :
9
+ branches :
10
+ - staging
6
11
7
12
jobs :
8
13
deploy :
9
14
runs-on : ubuntu-latest
10
- name : Ship Ship Ship
15
+ name : Deploy and Test
11
16
steps :
12
17
- name : Checkout Code
13
18
uses : actions/checkout@v4
19
+
20
+ - name : Determine Environment
21
+ id : env
22
+ run : |
23
+ if [[ ${{ github.event_name }} == 'pull_request' ]]; then
24
+ echo "WRANGLER_ENV=preview" >> $GITHUB_ENV
25
+ echo "TEST_URL=https://aibtcdev-cache.PREVIEW_URL" >> $GITHUB_ENV
26
+ elif [[ ${{ github.ref }} == 'refs/heads/staging' ]]; then
27
+ echo "WRANGLER_ENV=staging" >> $GITHUB_ENV
28
+ echo "TEST_URL=https://cache-staging.aibtc.dev" >> $GITHUB_ENV
29
+ else
30
+ echo "WRANGLER_ENV=production" >> $GITHUB_ENV
31
+ echo "TEST_URL=https://cache.aibtc.dev" >> $GITHUB_ENV
32
+ fi
33
+
14
34
- name : Deploy with Wrangler
15
35
uses : cloudflare/wrangler-action@v3
16
36
with :
17
37
apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
38
+ environment : ${{ env.WRANGLER_ENV }}
39
+
18
40
- name : Test Endpoints (10s delay)
19
41
run : |
20
42
chmod +x tests/run_tests.sh
21
- ./tests/run_tests.sh https://cache.aibtc.dev true
43
+ ./tests/run_tests.sh ${{ env.TEST_URL }} true
You can’t perform that action at this time.
0 commit comments