ci: inline deploy key setup for rsync
Some checks failed
deploy / build-and-deploy (push) Failing after 11s
Some checks failed
deploy / build-and-deploy (push) Failing after 11s
This commit is contained in:
@@ -30,11 +30,20 @@ jobs:
|
|||||||
PUBLIC_NEWSLETTER_DESCRIPTION: ${{ secrets.PUBLIC_NEWSLETTER_DESCRIPTION }}
|
PUBLIC_NEWSLETTER_DESCRIPTION: ${{ secrets.PUBLIC_NEWSLETTER_DESCRIPTION }}
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Start SSH agent
|
- name: Write deploy key
|
||||||
if: ${{ secrets.DEPLOY_SSH_KEY != '' }}
|
if: ${{ secrets.DEPLOY_SSH_KEY != '' }}
|
||||||
uses: webfactory/ssh-agent@v0.9.0
|
env:
|
||||||
with:
|
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||||
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
python3 - <<'PY'
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
key = os.environ['DEPLOY_SSH_KEY']
|
||||||
|
p = Path.home() / '.ssh' / 'deploy_key'
|
||||||
|
p.write_text(key, encoding='utf-8')
|
||||||
|
PY
|
||||||
|
chmod 600 ~/.ssh/deploy_key
|
||||||
|
|
||||||
- name: Add known_hosts
|
- name: Add known_hosts
|
||||||
if: ${{ secrets.DEPLOY_SSH_KEY != '' }}
|
if: ${{ secrets.DEPLOY_SSH_KEY != '' }}
|
||||||
@@ -45,4 +54,4 @@ jobs:
|
|||||||
- name: Deploy via rsync
|
- name: Deploy via rsync
|
||||||
if: ${{ secrets.DEPLOY_SSH_KEY != '' }}
|
if: ${{ secrets.DEPLOY_SSH_KEY != '' }}
|
||||||
run: |
|
run: |
|
||||||
rsync -az --delete -e "ssh -p ${{ secrets.DEPLOY_SSH_PORT }}" dist/ "${{ secrets.DEPLOY_SSH_USER }}@${{ secrets.DEPLOY_SSH_HOST }}:${{ secrets.DEPLOY_PATH }}/"
|
rsync -az --delete -e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.DEPLOY_SSH_PORT }}" dist/ "${{ secrets.DEPLOY_SSH_USER }}@${{ secrets.DEPLOY_SSH_HOST }}:${{ secrets.DEPLOY_PATH }}/"
|
||||||
|
|||||||
Reference in New Issue
Block a user