Skip to content

Update dashboard-publish.yml #26

Update dashboard-publish.yml

Update dashboard-publish.yml #26

# The name of the deployment
name: Deploy preview environments on PR
# When this action will be executed
on:
pull_request:
types: [opened, synchronize]
branches:
- main
workflow_dispatch:
env:
PR_NUMBER: ${{ github.event.number }}
jobs:
deploy_preview:
environment: playground
name: Deploy preview environment 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
npm ci
npm run generate
- 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
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}