-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (56 loc) · 2.38 KB
/
dashboard-feature-env.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
# The name of the deployment
name: Trigger auto deployment for containerapps
# When this action will be executed
on:
pull_request:
types: [opened, synchronize]
branches:
- main
workflow_dispatch:
env:
PR_NUMBER: ${{ github.event.number }}
jobs:
push_to_registry:
environment: playground
name: Push Docker image to Container App
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create Neon Branch
id: create-branch
uses: neondatabase/create-branch-action@v4
with:
project_id: ${{ env.NEON_PROJECT_ID }}
branch_name: preview/pr-${{ github.event.number }}
username: ${{ env.NEON_DATABASE_USERNAME }}
api_key: ${{ secrets.NEON_API_KEY }}
- name: Setup environment
run: |
echo "${{ secrets.AZURE_BLOB_STORAGE_ACCOUNT }}" >> ./ethereal-nexus-dashboard/.env
echo "${{ secrets.AZURE_BLOB_STORAGE_SECRET }}" >> ./ethereal-nexus-dashboard/.env
echo "DRIZZLE_DATABASE_TYPE=neon" >> ./ethereal-nexus-dashboard/.env
echo "DRIZZLE_DATABASE_URL=${{ steps.create-branch.outputs.db_url }}?sslmode=require" >> ./ethereal-nexus-dashboard/.env
echo "${{ secrets.NEXT_AUTH_SECRET }}" >> ./ethereal-nexus-dashboard/.env
cd ./ethereal-nexus-dashboard
npx drizzle-kit push:pg
- name: Deploy Container App
uses: azure/container-apps-deploy-action@v1
with:
containerAppName: ethereal-nexus-app-${{ github.event.number }}
appSourcePath: ${{ github.workspace }}/ethereal-nexus-dashboard
acrName: etherealnexus
acrUsername: ${{ secrets.REGISTRY_USERNAME }}
acrPassword: ${{ secrets.REGISTRY_PASSWORD }}
resourceGroup: RG-ethereal_realms_accelerator
containerAppEnvironment: ethereal-nexus-env
location: westeurope
targetPort: 3000
- name: Update Environment Variables
run: |
fqdn=$(az containerapp ingress show -g RG-ethereal_realms_accelerator -n ethereal-nexus-app-$PR_NUMBER | jq -r '.fqdn')
az containerapp update -g RG-ethereal_realms_accelerator -n ethereal-nexus-app-$PR_NUMBER --set-env-vars NEXTAUTH_URL=https://${fqdn}