-
Notifications
You must be signed in to change notification settings - Fork 50
71 lines (61 loc) · 2.29 KB
/
Copy pathstaging.yml
File metadata and controls
71 lines (61 loc) · 2.29 KB
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
name: Staging
on:
push:
branches: [staging]
pull_request:
types: [opened, synchronize, reopened]
jobs:
deploy-staging:
runs-on: ubuntu-latest
environment: staging
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm install --legacy-peer-deps
- run: npm run build
env:
NEXT_PUBLIC_STREAM_CONTRACT_ID_TESTNET: ${{ secrets.STAGING_CONTRACT_ID_TESTNET }}
NEXT_PUBLIC_APP_ENV: staging
- name: Install Vercel CLI
run: npm install -g vercel@latest
# Deploy preview for PRs, production-like staging deploy for staging branch
- name: Deploy to Vercel (staging branch)
if: github.ref == 'refs/heads/staging'
run: |
vercel deploy \
--token ${{ secrets.VERCEL_TOKEN }} \
--env NEXT_PUBLIC_STREAM_CONTRACT_ID_TESTNET=${{ secrets.STAGING_CONTRACT_ID_TESTNET }} \
--env NEXT_PUBLIC_APP_ENV=staging \
--prod \
--yes \
> deployment-url.txt
echo "Deployed to: $(cat deployment-url.txt)"
- name: Deploy preview (PR)
if: github.event_name == 'pull_request'
run: |
vercel deploy \
--token ${{ secrets.VERCEL_TOKEN }} \
--env NEXT_PUBLIC_STREAM_CONTRACT_ID_TESTNET=${{ secrets.STAGING_CONTRACT_ID_TESTNET }} \
--env NEXT_PUBLIC_APP_ENV=staging \
--yes \
> deployment-url.txt
PREVIEW_URL=$(cat deployment-url.txt)
echo "Preview URL: $PREVIEW_URL"
echo "PREVIEW_URL=$PREVIEW_URL" >> $GITHUB_ENV
- name: Comment PR with preview URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Staging Preview\n\nDeployed to: ${{ env.PREVIEW_URL }}\n\nThis preview uses the staging testnet contract (isolated from the shared testnet deployment).`
})