Skip to content

Commit

Permalink
Update and rename main.yml to prod-deployment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePrimeJnr authored Aug 12, 2024
1 parent e964a5f commit 772728d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 117 deletions.
117 changes: 0 additions & 117 deletions .github/workflows/main.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/prod-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Prod Deployment

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build-and-push:
if: github.event.repository.fork == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t nestjs_prod:green .

- name: Save and compress Docker image
run: |
docker save nestjs_prod:green | gzip > nestjs_prod.tar.gz
- name: Copy image to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "nestjs_prod.tar.gz"
target: "/tmp"

deploy:
needs: build-and-push
runs-on: ubuntu-latest
environment:
name: "dev"
url: ${{ vars.URL }}
steps:
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
./deploy.sh prod

0 comments on commit 772728d

Please sign in to comment.