Skip to content

deployment script

deployment script #1

name: Build and Deploy to EC2 (cfde-liver-main)
on:
push:
branches:
- cfde-liver-main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-ec2-cfde-liver-main
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Build production assets
run: npm run deploy
- name: Deploy dist to EC2
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
port: ${{ secrets.EC2_PORT || 22 }}
source: dist/*
target: ${{ secrets.EC2_TARGET_DIR_CFDE_LIVER }}
strip_components: 1
- name: Run post-deploy script
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
port: ${{ secrets.EC2_PORT || 22 }}
script: /opt/deploy/post-deploy.sh