diff --git a/.github/workflows/deploy_test.yml b/.github/workflows/deploy_test.yml index a14f485..6534281 100644 --- a/.github/workflows/deploy_test.yml +++ b/.github/workflows/deploy_test.yml @@ -1,6 +1,9 @@ name: Deploy to TDT4242 server development on: + push: + branches: + - main workflow_dispatch: inputs: config: @@ -18,11 +21,12 @@ jobs: runs-on: self-hosted env: REPO_NAME: ${{ github.event.repository.name }} - COMPOSE_FILE: ${{ github.event.inputs.config }} + COMPOSE_FILE: ${{ github.event.inputs.config || 'docker-compose.dev.yml' }} steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Dotenv Action uses: falti/dotenv-action@v1.1.4 with: @@ -35,7 +39,10 @@ jobs: 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 run: docker compose -f $COMPOSE_FILE up --force-recreate --build -d