Skip to content

Commit

Permalink
Fix (CI): Fix frontend deployment (#1011)
Browse files Browse the repository at this point in the history
* Fix (CI): Fix frontend build in deployment to tst & acc (#1007)

* 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)

* chore: Update podman.yml workflow conditions for acceptance deployment

* fix: Preload audio without MEDIA_ROOT

* revert: Do not automatically deploy this PR's commits to acceptance anymore as I (Drikus) have confirmed that Acceptance works again

* revert: Revert fix as I will address it in a separate PR
  • Loading branch information
drikusroor authored May 21, 2024
1 parent 7325716 commit 6d04769
Showing 1 changed file with 44 additions and 12 deletions.
56 changes: 44 additions & 12 deletions .github/workflows/podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
name: Deploy to test environment
environment: Test
runs-on: tst
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/develop'

# this job runs only on commits to the develop branch or when manually triggered for a branch other than main
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 +34,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 +60,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 +102,9 @@ jobs:
name: Deploy to acceptance environment
environment: Acceptance
runs-on: ACC
if: github.ref == 'refs/heads/main' || github.ref == 'refs/tags/*'

# this job runs only on commits to the main branch, tags, or when manually triggered for the main branch
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 +124,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 +150,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 6d04769

Please sign in to comment.