Skip to content

Merge pull request #71 from TC4Y-777/dev #27

Merge pull request #71 from TC4Y-777/dev

Merge pull request #71 from TC4Y-777/dev #27

Workflow file for this run

name: Deploy to stage environment
on:
push:
branches:
- "stage"
jobs:
build:
uses: ./.github/workflows/build.yml
deploy:
runs-on: ubuntu-latest
environment: stage
permissions:
contents: write
needs: build
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: "~/tithe-stage/"
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 tithe-stage
# echo vm.swappiness=0 | sudo tee -a /etc/sysctl.conf
SCRIPT_AFTER: |
ls -a
echo "================="
echo "Change current directory to tithe-stage"
echo "================="
cd tithe-stage
echo "================="
echo "Start Stage Deploy Script"
echo "================="
sudo chmod +x ./stage-deploy.sh
./stage-deploy.sh