Skip to content

typo fix in .pem file #11

typo fix in .pem file

typo fix in .pem file #11

Workflow file for this run

name: Deploy to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Build the app
run: npm run build
- name: Decode SSH Key
run: echo "${{ secrets.EC2_SSH_KEY }}" | base64 --decode > my-wesite-server.pem
- name: Set permissions
run: chmod 600 my-website-server.pem
- name: Debug PEM file content
run: cat my-wesite-server.pem
- name: Check if PEM file exists
run: |
ls -l
- name: Copy files to EC2 using SCP
run: |
scp -i my-website-server.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r build/* ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/var/www/html/
- name: Restart Nginx
run: |
ssh -i my-website-server.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "sudo systemctl reload nginx"