-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (93 loc) · 3.38 KB
/
Copy pathdeploy.yml
File metadata and controls
103 lines (93 loc) · 3.38 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
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
100
101
102
103
name: Deploy
on:
push:
tags:
- "public-v*"
- "admin-v*"
env:
REGISTRY: ghcr.io
jobs:
build-admin:
if: startsWith(github.ref_name, 'admin-v')
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push admin image
uses: docker/build-push-action@v6
with:
context: .
file: apps/admin/Dockerfile
push: true
build-args: |
NEXT_PUBLIC_BETTER_AUTH_URL=${{ secrets.NEXT_PUBLIC_BETTER_AUTH_URL }}
NEXT_PUBLIC_APP_URL=${{ secrets.NEXT_PUBLIC_APP_URL }}
NEXT_PUBLIC_STRIPE_PUBLIC_KEY=${{ secrets.NEXT_PUBLIC_STRIPE_PUBLIC_KEY }}
NEXT_PUBLIC_POSTHOG_KEY=${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST=${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}
tags: |
${{ env.REGISTRY }}/${{ github.repository }}/admin:${{ github.ref_name }}
${{ env.REGISTRY }}/${{ github.repository }}/admin:latest
build-public:
if: startsWith(github.ref_name, 'public-v')
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push public image
uses: docker/build-push-action@v6
with:
context: .
file: apps/public/Dockerfile
push: true
build-args: |
NEXT_PUBLIC_ADMIN_URL=${{ secrets.NEXT_PUBLIC_ADMIN_URL }}
NEXT_PUBLIC_POSTHOG_KEY=${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}
NEXT_PUBLIC_POSTHOG_HOST=${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}
POSTHOG_PERSONAL_API_KEY=${{ secrets.POSTHOG_PERSONAL_API_KEY }}
POSTHOG_PROJECT_ID=${{ secrets.POSTHOG_PROJECT_ID }}
tags: |
${{ env.REGISTRY }}/${{ github.repository }}/public:${{ github.ref_name }}
${{ env.REGISTRY }}/${{ github.repository }}/public:latest
deploy-public:
needs: build-public
if: startsWith(github.ref_name, 'public-v')
runs-on: ubuntu-latest
steps:
- name: Deploy to CapRover (public)
uses: caprover/deploy-from-github@v1.1.2
with:
server: ${{ secrets.CAPROVER_SERVER }}
app: ${{ secrets.CAPROVER_APP_PUBLIC }}
token: ${{ secrets.CAPROVER_TOKEN_PUBLIC }}
image: ${{ env.REGISTRY }}/${{ github.repository }}/public:${{ github.ref_name }}
deploy-admin:
needs: build-admin
if: startsWith(github.ref_name, 'admin-v')
runs-on: ubuntu-latest
steps:
- name: Deploy to CapRover (admin)
uses: caprover/deploy-from-github@v1.1.2
with:
server: ${{ secrets.CAPROVER_SERVER }}
app: ${{ secrets.CAPROVER_APP_ADMIN }}
token: ${{ secrets.CAPROVER_TOKEN_ADMIN }}
image: ${{ env.REGISTRY }}/${{ github.repository }}/admin:${{ github.ref_name }}