Skip to content

Commit

Permalink
Create Dev.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
prasadharke-tekdi authored Mar 15, 2024
1 parent b097155 commit ed92ecb
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/Dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: DEV DEPLOYMENT

on:
push:
branches: [ ]

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Load .env from GitHub Secret
run: echo "${{ secrets.MY_ENV_VARS }}" > .env

-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }}
env:
MY_ENV_VARS: ${{ secrets.MY_ENV_VARS }}
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [build]
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Deploy Stack
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
docker login
docker container stop ${{ secrets.CONTAINER_NAME }}
docker rm ${{ secrets.CONTAINER_NAME }}
docker rmi ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }}
docker pull ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }}
docker-compose up -d --force-recreate --no-deps

0 comments on commit ed92ecb

Please sign in to comment.