Skip to content

Commit

Permalink
fix: web-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchandev authored Oct 14, 2024
1 parent 453482a commit 61c2156
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/web-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
- 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: Extract Payload Values
id: extract-payload
run: |
echo "SOURCE_DIRECTORY=${{ github.event.client_payload.source_directory }}" >> $GITHUB_ENV
echo "DESTINATION_DIRECTORY=${{ github.event.client_payload.destination_directory }}" >> $GITHUB_ENV
- 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 ${{ env.DESTINATION_DIRECTORY }}"
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 }}" ${{ env.SOURCE_DIRECTORY }} ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:${{ env.DESTINATION_DIRECTORY }}
rsync -avz -e "ssh -i ${{ secrets.SERVER_SSH_KEY }}" ./build/ ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:${{ github.event.client_payload.destination_directory }}

0 comments on commit 61c2156

Please sign in to comment.