Skip to content

Commit 8e517e4

Browse files
authored
Update deploy.yml
1 parent d8804c5 commit 8e517e4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ jobs:
2222
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519
2323
chmod 600 ~/.ssh/id_ed25519
2424
25-
cat <<EOF > ~/.ssh/config
26-
Host ${{ secrets.SSH_HOST }}
27-
ProxyCommand /usr/local/bin/cloudflared access ssh --hostname %h --id ${{ secrets.CF_CLIENT_ID }} --secret ${{ secrets.CF_CLIENT_SECRET }}
28-
EOF
25+
# Define the ProxyCommand variable for reuse
26+
PROXY="cloudflared access ssh --hostname ${{ secrets.SSH_HOST }} --id ${{ secrets.CF_CLIENT_ID }} --secret ${{ secrets.CF_CLIENT_SECRET }}"
2927
30-
rsync -e "ssh -o StrictHostKeyChecking=no" -avz --delete --exclude '.git' . ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/${{ github.event.repository.name }}
28+
# Run rsync
29+
rsync -e "ssh -o StrictHostKeyChecking=no -o ProxyCommand='$PROXY'" -avz --delete --exclude '.git' . ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/${{ github.event.repository.name }}
3130
32-
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
31+
# Run SSH commands
32+
ssh -o StrictHostKeyChecking=no -o ProxyCommand="$PROXY" ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
3333
cd /var/www/${{ github.event.repository.name }}
3434
35+
# Use sudo if nixpacks/pm2 requires it
3536
nixpacks build . --name ${{ github.event.repository.name }}
3637
3738
pm2 restart ${{ github.event.repository.name }} || pm2 start "nixpacks run ." --name ${{ github.event.repository.name }}

0 commit comments

Comments
 (0)