Skip to content

Commit

Permalink
change scp to rsync frontend deployment (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
juancwu authored Dec 9, 2024
2 parents f230822 + 438cc8d commit 808f82d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
key: ${{ secrets.VPS_KEY }}
envs: DB_NAME,DB_PASSWORD,DB_PORT,DB_SSLMODE,DB_USER,APP_NAME,APP_ENV
script: |
cd $HOME/staging
cd $HOME/$APP_ENV
echo "Stopping and removing existing container if present..."
CONTAINER="$APP_NAME-$APP_ENV"
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/deploy-staging-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup VPS fingerprint
run: |
mkdir -p ~/.ssh
echo "${{ secrets.VPS_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "${{ secrets.VPS_IP }} ${{ secrets.VPS_FINGERPRINT }}" >> ~/.ssh/known_hosts
- name: Setup Rsync
uses: GuillaumeFalourd/[email protected]
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
Expand Down Expand Up @@ -47,11 +55,5 @@ jobs:
- name: Build
run: pnpm build
- name: Deploy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_IP }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_KEY }}
source: "frontend/dist/*"
target: "${{ secrets.FE_DIR }}"
strip_components: 2
run: |
rsync -avz --progress dist/* "${{ secrets.VPS_USER }}@${{ secrets.VPS_IP }}:~/${{ secrets.APP_ENV }}/frontend"

0 comments on commit 808f82d

Please sign in to comment.