Skip to content

Commit

Permalink
Fix (CI): Fix frontend build in deployment to tst & acc (#1007)
Browse files Browse the repository at this point in the history
* config: Set SENTRY_ENVIRONMENT to "test" and "acceptance" in relevant files so Sentry knows which environment it is running on (#972)

* ci: Update podman.yml workflow conditions

The `if` conditions in the `podman.yml` workflow file have been updated to include additional checks for the `workflow_dispatch` event. This ensures that the workflow is triggered correctly for the workflow dispatch button in combination with either the `develop` or the `main` branch.

* chore: Update podman.yml workflow variables to avoid the vite build failing due to missing environment variables

This commit updates the `podman.yml` workflow file to include additional variables related to the frontend HTML. These variables are used for the favicon, logo URL, Open Graph (OG) description, OG image, OG title, OG URL, and body class. The variables are set to empty strings if not provided. This change ensures that the workflow has the necessary variables for the frontend HTML.

* ci: Temporarily turn on deploy for acceptance on this branch

* chore: Try if manually setting the favicon fixes things

* ci: Update podman.yml workflow variables to include frontend HTML environment variables

This commit updates the `podman.yml` workflow file to include additional variables related to the frontend HTML. These variables are used for the favicon, logo URL, Open Graph (OG) description, OG image, OG title, OG URL, and body class. The variables are set to empty strings if not provided. This change ensures that the workflow has the necessary variables for the frontend HTML.

* ci: Test deploy to test environment

* chore: Update podman.yml workflow conditions for develop branch

(cherry picked from commit 257b3a7)
  • Loading branch information
drikusroor committed May 15, 2024
1 parent 1d0667d commit 7adef00
Showing 1 changed file with 40 additions and 12 deletions.
52 changes: 40 additions & 12 deletions .github/workflows/podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Deploy to test environment
environment: Test
runs-on: tst
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/develop'
if: github.ref == 'refs/heads/develop' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main')
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
env:
Expand All @@ -32,6 +32,13 @@ jobs:
FRONTEND_EXPERIMENT_SLUG: ${{ vars.FRONTEND_EXPERIMENT_SLUG }}
FRONTEND_AML_HOME: ${{ vars.FRONTEND_AML_HOME }}
FRONTEND_HTML_PAGE_TITLE: ${{ vars.FRONTEND_HTML_PAGE_TITLE }}
FRONTEND_HTML_FAVICON: ${{ vars.FRONTEND_HTML_FAVICON || '' }}
FRONTEND_LOGO_URL: ${{ vars.FRONTEND_LOGO_URL || '' }}
FRONTEND_HTML_OG_DESCRIPTION: ${{ vars.FRONTEND_HTML_OG_DESCRIPTION || '' }}
FRONTEND_HTML_OG_IMAGE: ${{ vars.FRONTEND_HTML_OG_IMAGE || '' }}
FRONTEND_HTML_OG_TITLE: ${{ vars.FRONTEND_HTML_OG_TITLE || '' }}
FRONTEND_HTML_OG_URL: ${{ vars.FRONTEND_HTML_OG_URL || '' }}
FRONTEND_HTML_BODY_CLASS: ${{ vars.FRONTEND_HTML_BODY_CLASS || '' }}

# Secrets
AML_SECRET_KEY: ${{ secrets.AML_SECRET_KEY }}
Expand All @@ -51,11 +58,18 @@ jobs:
- name: Create .env file
run: |
touch .env
echo "FRONTEND_API_ROOT=$FRONTEND_API_ROOT" >> .env
echo "FRONTEND_EXPERIMENT_SLUG=$FRONTEND_EXPERIMENT_SLUG" >> .env
echo "FRONTEND_AML_HOME=$FRONTEND_AML_HOME" >> .env
echo "FRONTEND_HTML_PAGE_TITLE=$FRONTEND_HTML_PAGE_TITLE" >> .env
echo "FRONTEND_SENTRY_DSN=$FRONTEND_SENTRY_DSN" >> .env
echo "VITE_API_ROOT=$FRONTEND_API_ROOT" >> .env
echo "VITE_EXPERIMENT_SLUG=$FRONTEND_EXPERIMENT_SLUG" >> .env
echo "VITE_AML_HOME=$FRONTEND_AML_HOME" >> .env
echo "VITE_LOGO_URL=$FRONTEND_LOGO_URL" >> .env
echo "VITE_HTML_FAVICON=$FRONTEND_HTML_FAVICON" >> .env
echo "VITE_HTML_PAGE_TITLE=$FRONTEND_HTML_PAGE_TITLE" >> .env
echo "VITE_HTML_OG_DESCRIPTION=$FRONTEND_HTML_OG_DESCRIPTION" >> .env
echo "VITE_HTML_OG_IMAGE=$FRONTEND_HTML_OG_IMAGE" >> .env
echo "VITE_HTML_OG_TITLE=$FRONTEND_HTML_OG_TITLE" >> .env
echo "VITE_HTML_OG_URL=$FRONTEND_HTML_OG_URL" >> .env
echo "VITE_HTML_BODY_CLASS=$FRONTEND_HTML_BODY_CLASS" >> .env
echo "VITE_SENTRY_DSN=$FRONTEND_SENTRY_DSN" >> .env
cp .env frontend/.env
- name: Build Podman images
run: podman-compose -f docker-compose-deploy.yml build
Expand Down Expand Up @@ -86,7 +100,7 @@ jobs:
name: Deploy to acceptance environment
environment: Acceptance
runs-on: ACC
if: github.ref == 'refs/heads/main' || github.ref == 'refs/tags/*'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/tags/*' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
env:
Expand All @@ -106,6 +120,13 @@ jobs:
FRONTEND_EXPERIMENT_SLUG: ${{ vars.FRONTEND_EXPERIMENT_SLUG }}
FRONTEND_AML_HOME: ${{ vars.FRONTEND_AML_HOME }}
FRONTEND_HTML_PAGE_TITLE: ${{ vars.FRONTEND_HTML_PAGE_TITLE }}
FRONTEND_HTML_FAVICON: ${{ vars.FRONTEND_HTML_FAVICON || '' }}
FRONTEND_LOGO_URL: ${{ vars.FRONTEND_LOGO_URL || '' }}
FRONTEND_HTML_OG_DESCRIPTION: ${{ vars.FRONTEND_HTML_OG_DESCRIPTION || '' }}
FRONTEND_HTML_OG_IMAGE: ${{ vars.FRONTEND_HTML_OG_IMAGE || '' }}
FRONTEND_HTML_OG_TITLE: ${{ vars.FRONTEND_HTML_OG_TITLE || '' }}
FRONTEND_HTML_OG_URL: ${{ vars.FRONTEND_HTML_OG_URL || '' }}
FRONTEND_HTML_BODY_CLASS: ${{ vars.FRONTEND_HTML_BODY_CLASS || '' }}

# Secrets
AML_SECRET_KEY: ${{ secrets.AML_SECRET_KEY }}
Expand All @@ -125,11 +146,18 @@ jobs:
- name: Create .env file
run: |
touch .env
echo "FRONTEND_API_ROOT=$FRONTEND_API_ROOT" >> .env
echo "FRONTEND_EXPERIMENT_SLUG=$FRONTEND_EXPERIMENT_SLUG" >> .env
echo "FRONTEND_AML_HOME=$FRONTEND_AML_HOME" >> .env
echo "FRONTEND_HTML_PAGE_TITLE=$FRONTEND_HTML_PAGE_TITLE" >> .env
echo "FRONTEND_SENTRY_DSN=$FRONTEND_SENTRY_DSN" >> .env
echo "VITE_API_ROOT=$FRONTEND_API_ROOT" >> .env
echo "VITE_EXPERIMENT_SLUG=$FRONTEND_EXPERIMENT_SLUG" >> .env
echo "VITE_AML_HOME=$FRONTEND_AML_HOME" >> .env
echo "VITE_LOGO_URL=$FRONTEND_LOGO_URL" >> .env
echo "VITE_HTML_FAVICON=$FRONTEND_HTML_FAVICON" >> .env
echo "VITE_HTML_PAGE_TITLE=$FRONTEND_HTML_PAGE_TITLE" >> .env
echo "VITE_HTML_OG_DESCRIPTION=$FRONTEND_HTML_OG_DESCRIPTION" >> .env
echo "VITE_HTML_OG_IMAGE=$FRONTEND_HTML_OG_IMAGE" >> .env
echo "VITE_HTML_OG_TITLE=$FRONTEND_HTML_OG_TITLE" >> .env
echo "VITE_HTML_OG_URL=$FRONTEND_HTML_OG_URL" >> .env
echo "VITE_HTML_BODY_CLASS=$FRONTEND_HTML_BODY_CLASS" >> .env
echo "VITE_SENTRY_DSN=$FRONTEND_SENTRY_DSN" >> .env
cp .env frontend/.env
- name: Build Podman images
run: podman-compose -f docker-compose-deploy.yml build
Expand Down

0 comments on commit 7adef00

Please sign in to comment.