From 61c2156b50e361881cdc46587e038db2fe508bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=99=EC=B0=AC?= <129833370+dongchandev@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:35:15 +0900 Subject: [PATCH] fix: web-deploy.yml --- .github/workflows/web-deploy.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml index 171b636..b040700 100644 --- a/.github/workflows/web-deploy.yml +++ b/.github/workflows/web-deploy.yml @@ -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 }}