-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 3.08 KB
/
pr.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: PR
on:
merge_group:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
app-preview:
runs-on: ubuntu-latest
env:
# Format: 'github_test_pr_' <run_id> [ ':' <run_attempt> ]
#
# The run attempt is only included for re-runs to keep the branch name
# slightly shorter and cleaner when there is no re-run.
NEON_BRANCH_NAME: github_test_pr_${{ github.run_id }}${{ github.run_attempt != '1' && format(':{0}', github.run_attempt) || '' }}
NEON_DATABASE_NAME: hao
steps:
- name: 🏗 Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏗 Create database branch for running tests
uses: neondatabase/create-branch-action@v5
id: create-neon-branch
with:
api_key: ${{ secrets.NEON_API_KEY }}
branch_name: ${{ env.NEON_BRANCH_NAME }}
database: ${{ env.NEON_DATABASE_NAME }}
project_id: ${{ secrets.NEON_PROJECT_ID }}
username: ${{ secrets.NEON_USERNAME }}
- uses: ./.github/actions/setup-tools
- run: moon run app:dbMigrate --color --affected --remote
env:
DATABASE_URL: ${{ steps.create-neon-branch.outputs.db_url }}
- name: 🚀 Deploy to Vercel (preview)
run: moon run app:deployVercel --color --affected --remote
env:
EXPO_PUBLIC_REPLICACHE_LICENSE_KEY: ${{ secrets.EXPO_PUBLIC_REPLICACHE_LICENSE_KEY }}
HHH_VERCEL_PREVIEW:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_APP }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
- uses: neondatabase/delete-branch-action@v3
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: ${{ env.NEON_BRANCH_NAME }}
api_key: ${{ secrets.NEON_API_KEY }}
if: ${{ always() }}
static-preview:
runs-on: ubuntu-latest
steps:
- name: 🏗 Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-tools
- name: 🚀 Deploy to Vercel (preview)
run: moon run static:deploy --color --affected --remote
env:
HHH_VERCEL_PREVIEW:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STATIC }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
moon-ci:
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STATIC }}
EXPO_PUBLIC_REPLICACHE_LICENSE_KEY: TEST_LICENSE_KEY
strategy:
matrix:
index: [0, 1]
steps:
- name: 🏗 Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-tools
- run: moon ci --color --job ${{ matrix.index }} --jobTotal 2
- name: 🧾 Results
uses: appthrust/moon-ci-retrospect@v1
if: ${{ always() }}