Skip to content

Commit

Permalink
deploy when pushing code to main
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianrd committed Mar 20, 2025
1 parent 68b079b commit 207c9d4
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 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

on:
push:
branches:
# - dev
# - staging
- main
workflow_dispatch:
inputs:
config:
Expand All @@ -18,8 +23,14 @@ 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/main' && 'docker-compose.yml') }}

# COMPOSE_FILE: ${{ github.event.inputs.config ||
# (github.ref == 'refs/heads/main' && 'docker-compose.yml') ||
# (github.ref == 'refs/heads/staging' && 'docker-compose.stag.yml') ||
# (github.ref == 'refs/heads/dev' && 'docker-compose.dev.yml') }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -35,9 +46,9 @@ jobs:
docker compose version
cd $GITHUB_WORKSPACE
docker compose -f $COMPOSE_FILE --verbose config && printf "OK\n" || exit 1
- name: Build and run docker image
- name: Build and run docker image
run: docker compose -f $COMPOSE_FILE up --force-recreate --build -d

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

0 comments on commit 207c9d4

Please sign in to comment.