Skip to content

Create newaltv1-dev-frontend.yml #1

Create newaltv1-dev-frontend.yml

Create newaltv1-dev-frontend.yml #1

name: Deploy to DEV
on:
push:
branches:
- newaltv1
jobs:
build:
name: Generate Build and Deploy to DEV
# environment: PROD
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node Env
uses: actions/setup-node@v3
with:
node-version: 21.1.0
# - name: Copy .env file
# env:
# ENV_FILE_CONTENT: ${{ secrets.env }}
# run: echo "$ENV_FILE_CONTENT" > .env
- name: Generate React Build
run: |
yarn install
yarn build
- name: Show PWD
run: |
echo "Current Working Directory:"
pwd
- name: Create Directory
run: mkdir my_directory
- name: List Contents
run: |
echo "Contents of the current directory (in reverse order):"
ls -lr
- name: List Contents
run: |
echo "Contents of the dist directory (in reverse order):"
cd /home/runner/work/scholarship-app-ui/scholarship-app-ui/dist
ls -lr
- name: Deploy to Server 1
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY_NEWALTV1_DEV }}
REMOTE_HOST: ${{ secrets.HOST_DNS_NEWALTV1_DEV }}
REMOTE_USER: ${{ secrets.USERNAME_NEWALTV1_DEV }}
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_SSH_KEY_NEWALTV1_DEV }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# Add the SSH key to the known_hosts file (replace hostname with your actual hostname)
ssh-keyscan -H ${{ secrets.HOST_DNS_NEWALTV1_DEV }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: |
rsync -avz -e "ssh -i ~/.ssh/id_rsa" ./dist/ ${{ secrets.USERNAME_NEWALTV1_DEV }}@${{ secrets.HOST_DNS_NEWALTV1_DEV }}:/var/www/scholarship-dev.tekdinext.com/public
- name: Notify on Slack channel
uses: iRoachie/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NEWALTV1_URL }}
with:
status: ${{ job.status }}
if: ${{ always() }}