Skip to content

Commit

Permalink
feat: added workflow dispatch github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
aswanthabam committed Jan 4, 2025
1 parent ae4c8ae commit 545729d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/dev-deploy-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Dev CI

on:
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy"
required: true
default: "dev-server"

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Configure SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}

- name: Deploy
env:
REMOTE_IP: ${{ secrets.DEV_REMOTE_IP }}
PROJECT_PATH: ${{ secrets.PROJECT_PATH }}
BRANCH_NAME: ${{ github.event.inputs.branch }}
run: |
ssh -o StrictHostKeyChecking=no ubuntu@$REMOTE_IP "
cd $PROJECT_PATH &&
git fetch origin &&
git checkout $BRANCH_NAME &&
git reset --hard origin/$BRANCH_NAME &&
docker-compose down &&
docker-compose up --build -d
"

0 comments on commit 545729d

Please sign in to comment.