Skip to content

Commit

Permalink
ci: Add gh action to deploy on dev and uat
Browse files Browse the repository at this point in the history
  • Loading branch information
plduthoit authored Sep 3, 2024
1 parent ff4d9f8 commit b6f23b5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to Server

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

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

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

- name: Deploy to UAT
if: github.ref == 'refs/heads/main'
run: |
ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \
"cd /home/ubuntu/puc_uat && git fetch origin && git reset --hard origin/main && make deploy"
- name: Deploy to Dev
if: github.event_name == 'workflow_dispatch'
run: |
ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \
"cd /home/ubuntu/puc_dev && git fetch origin && git reset --hard origin/${{ github.ref_name }} && make deploy"

0 comments on commit b6f23b5

Please sign in to comment.