Skip to content

trigger-deploy

trigger-deploy #2

Workflow file for this run

name: Deploy Web Project
on:
repository_dispatch:
types: [trigger-deploy]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v2
with:
repository: ${{ github.event.client_payload.repo_name }}
ref: ${{ github.event.client_payload.branch }}
token: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: Install Dependencies
run: npm install
- name: Build Project
run: npm run build
- name: Create Destination Directory If Not Exists
run: |
ssh -i ${{ secrets.SERVER_SSH_KEY }} ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "mkdir -p ${{ github.event.client_payload.destination_directory }}"
- name: Deploy Files to Server
run: |
rsync -avz -e "ssh -i ${{ secrets.SERVER_SSH_KEY }}" ./build/ ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:${{ github.event.client_payload.destination_directory }}