Skip to content

Create prod-deploy.yml #1

Create prod-deploy.yml

Create prod-deploy.yml #1

Workflow file for this run

name: Deploy to production environment
on:
push:
branches:
- "main"
jobs:
deploy:
runs-on: ubuntu-latest
environment: prod
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Deploy on AWS EC2
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }}
ARGS: "-rlgoDzvc -i"
SOURCE: "./"
REMOTE_HOST: ${{ secrets.AWS_EC2_HOSTNAME }}
REMOTE_USER: ${{ secrets.AWS_EC2_USERNAME }}
TARGET: "~/asset-management/"
EXCLUDE: "/dist/, /node_modules/"
SCRIPT_BEFORE: |
ls -a
echo "================="
echo "Update"
echo "================="
sudo apt-get update -y
echo "================="
echo "Upgrade"
echo "================="
sudo apt-get upgrade -y
echo "================="
echo "Install rsync"
echo "================="
sudo apt-get install -y rsync
echo "================="
echo "Create Directory"
echo "================="
mkdir -p asset-management
SCRIPT_AFTER: |
ls -a
echo "================="
echo "Change current directory to asset-management"
echo "================="
cd asset-management
echo "================="
echo "Start Production Deploy Script"
echo "================="
sudo chmod +x ./prod-deploy.sh
./prod-deploy.sh