Skip to content

Commit

Permalink
Updated deploy_test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander Johansen committed Mar 5, 2025
1 parent a08b437 commit 3575b0b
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/deploy_test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Deploy to TDT4242 server development
name: Deploy to TDT4242 server

on:
push:
branches:
- main
- dev # Deploy Dev when pushing to `dev`
- staging # Deploy Staging when pushing to `staging`
- main # Deploy Prod when pushing to `main`
workflow_dispatch:
inputs:
config:
Expand All @@ -20,31 +22,23 @@ jobs:
deploy:
runs-on: self-hosted
env:
REPO_NAME: ${{ github.event.repository.name }}
COMPOSE_FILE: ${{ github.event.inputs.config || 'docker-compose.dev.yml' }}

COMPOSE_FILE: ${{ github.ref == 'refs/heads/main' && 'docker-compose.yml' || github.ref == 'refs/heads/staging' && 'docker-compose.stag.yml' || 'docker-compose.dev.yml' }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Dotenv Action
- name: Load environment variables
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass

- name: Check status of config file
run: |
env
docker compose version
cd $GITHUB_WORKSPACE
docker compose -f $COMPOSE_FILE --verbose config && printf "OK\n" || exit 1
- name: Stop existing containers
run: docker compose -f $COMPOSE_FILE down

- name: Build and run docker image
- name: Build and run updated containers
run: docker compose -f $COMPOSE_FILE up --force-recreate --build -d
- name: Verify that gateway is available
run: docker ps

- name: Verify running containers
run: docker ps

0 comments on commit 3575b0b

Please sign in to comment.