fixed syntax in yml #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to EC2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Build project | |
run: npm run build | |
- name: Copy SSH key | |
run: | | |
echo "${{ secrets.EC2_KEY }}" > key.pem | |
chmod 600 key.pem | |
- name: Deploy to EC2 | |
env: | |
EC2_HOST: ${{ secrets.EC2_HOST }} | |
EC2_USER: ${{ secrets.EC2_USER }} | |
run: | | |
ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF' | |
cd /home/ubuntu/ethora-docs | |
chmod +x deploy.sh | |
./deploy.sh | |
EOF |