Skip to content

Commit

Permalink
Try to fix deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leonief authored and GitHub Enterprise committed Mar 17, 2025
1 parent e7fa863 commit 40ac7a5
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 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,13 @@ jobs:

- name: Check status of config file
run: |
env
echo "Using compose file: $COMPOSE_FILE"
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
docker compose -f $COMPOSE_FILE config --verbose && printf "OK\n" || exit 1
- name: Build and run docker image
run: 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 40ac7a5

Please sign in to comment.