Skip to content

Commit

Permalink
Update deploy_test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jifollan authored and GitHub Enterprise committed Mar 20, 2025
1 parent e8b7f30 commit 4b0428a
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/deploy_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Deploy to TDT4242 server development
name: Deploy to TDT4242 server

on:
push:
branches:
- dev
- stage
- main
workflow_dispatch:
inputs:
config:
Expand All @@ -18,11 +23,17 @@ jobs:
runs-on: self-hosted
env:
REPO_NAME: ${{ github.event.repository.name }}
COMPOSE_FILE: ${{ github.event.inputs.config }}

COMPOSE_FILE: >-
${{ github.event.inputs.config ||
(github.ref == 'refs/heads/dev' && 'docker-compose.dev.yml') ||
(github.ref == 'refs/heads/stage' && 'docker-compose.stag.yml') ||
(github.ref == 'refs/heads/main' && 'docker-compose.yml')
}}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Dotenv Action
uses: falti/dotenv-action@v1.1.4
with:
Expand All @@ -31,13 +42,16 @@ jobs:

- name: Check status of config file
run: |
env
docker compose version
echo "Using compose file: $COMPOSE_FILE"
sudo docker compose version
cd $GITHUB_WORKSPACE
docker compose -f $COMPOSE_FILE --verbose config && printf "OK\n" || exit 1
- name: Build and run docker image
run: docker compose -f $COMPOSE_FILE up --force-recreate --build -d

sudo docker compose -f $COMPOSE_FILE config && echo "Compose file is valid" || exit 1
- name: Build and run docker image
run: |
echo "Deploying with compose file: $COMPOSE_FILE"
sudo docker compose -f $COMPOSE_FILE up --force-recreate --build -d

- name: Verify that gateway is available
run: docker ps
run: sudo docker ps

0 comments on commit 4b0428a

Please sign in to comment.