Skip to content

Fix type validity errors #36

Fix type validity errors

Fix type validity errors #36

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- staging
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: secret
POSTGRES_DB: namukilke
POSTGRES_USER: namukilke
options: >-
--health-cmd pg_isready
--health-interval 6s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Log in to Azure
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
allow-no-subscriptions: true
# Login to ACR
- name: login to ACR
run: az acr login --name ${{ secrets.ACR_REGISTRY_NAME }}
# Set up Docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
cleanup: true
# Build the docker image
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.ACR_REGISTRY_NAME }}.azurecr.io/namukilke/namukilke:${{ github.sha }}
# There is intentionally no scope on the cache due to github's cache access restrictions.
# Both the release and debug file will now be stored in the same location.
# cache-from: type=gha
# cache-to: type=gha,mode=max
build-args: |
"DATABASE_URL=postgres://namukilke:secret@localhost:5432/namukilke"
"NEXT_PUBLIC_STRIPE_TESTMODE_PUBLISHABLE_KEY=${{ vars.NEXT_PUBLIC_STRIPE_TESTMODE_PUBLISHABLE_KEY }}"
"NEXT_PUBLIC_AZURE_BLOB_STORAGE_URL=${{ vars.NEXT_PUBLIC_AZURE_BLOB_STORAGE_URL }}"
"NEXT_PUBLIC_URL_PROD=${{ vars.NEXT_PUBLIC_URL_PROD }}"
"SKIP_ENV_VALIDATION=true"
allow: |
network.host
security.insecure
network: host
# Logout
- name: Azure logout
run: |
az logout
deploy:
runs-on: ubuntu-latest
needs: build
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Log in to Azure
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
allow-no-subscriptions: true
- name: Docker login to ACR
run: az acr login --name ${{ secrets.ACR_REGISTRY_NAME }}
- name: Deploy from ACR
run: |
az webapp config container set \
--container-image-name ${{ secrets.ACR_REGISTRY_NAME }}.azurecr.io/namukilke/namukilke:${{ github.sha }} \
--container-registry-url https://${{ secrets.ACR_REGISTRY_NAME }}.azurecr.io \
--subscription ${{ secrets.SUBSCRIPTION }} \
--resource-group prodeko-rg \
--name namu2
- name: Azure logout
run: |
az logout