Fix CI/CD: use printf for SSH key to preserve formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
67c7ab3289
commit
c5ecda0a44
1 changed files with 9 additions and 12 deletions
21
.github/workflows/deploy.yml
vendored
21
.github/workflows/deploy.yml
vendored
|
|
@ -19,22 +19,19 @@ jobs:
|
|||
- run: npm ci
|
||||
- run: npm run build
|
||||
|
||||
- name: Deploy to server
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
SERVER: ubuntu@57.128.160.249
|
||||
SSH_PORT: "1220"
|
||||
REMOTE_DIR: /opt/00-infrastructure/Website/website
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_KEY" > ~/.ssh/id_deploy
|
||||
printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_deploy
|
||||
chmod 600 ~/.ssh/id_deploy
|
||||
ssh-keyscan -p $SSH_PORT 57.128.160.249 >> ~/.ssh/known_hosts 2>/dev/null
|
||||
ssh-keyscan -p 1220 57.128.160.249 >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
- name: Deploy to server
|
||||
run: |
|
||||
rsync -avz --delete \
|
||||
--exclude='blog/' \
|
||||
-e "ssh -p $SSH_PORT -i ~/.ssh/id_deploy" \
|
||||
dist/ "$SERVER:$REMOTE_DIR/dist/"
|
||||
-e "ssh -p 1220 -i ~/.ssh/id_deploy" \
|
||||
dist/ ubuntu@57.128.160.249:/opt/00-infrastructure/Website/website/dist/
|
||||
|
||||
ssh -p $SSH_PORT -i ~/.ssh/id_deploy $SERVER \
|
||||
"cd $REMOTE_DIR && docker compose restart web"
|
||||
ssh -p 1220 -i ~/.ssh/id_deploy ubuntu@57.128.160.249 \
|
||||
"cd /opt/00-infrastructure/Website/website && docker compose restart web"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue