Skip to content

Commit ceadba5

Browse files
authored
fix(staging): upload latest deploy script via ssh payload (#166)
- replace flaky scp step with base64 payload transfer in the ssh deploy step - always write latest scripts/stage/deploy.sh to /tmp/deploy.sh before execution - keep deployment flow explicit: copy script first, then chmod and run
1 parent 8f7c998 commit ceadba5

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

.github/workflows/staging.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515

16-
- name: Copy staging deploy script
17-
uses: appleboy/scp-action@master
18-
with:
19-
host: ${{ vars.STAGING_SERVER_HOST }}
20-
username: ${{ vars.STAGING_SERVER_USER }}
21-
key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }}
22-
proxy_host: ${{ vars.STAGING_PROXY_HOST }}
23-
proxy_username: ${{ vars.STAGING_PROXY_USER }}
24-
proxy_key: ${{ secrets.STAGING_PROXY_SSH_PRIVATE_KEY }}
25-
source: "scripts/stage/deploy.sh"
26-
target: "/tmp"
27-
strip_components: 1
16+
- name: Prepare staging deploy script payload
17+
id: deploy_script
18+
run: |
19+
SCRIPT_B64="$(base64 < scripts/stage/deploy.sh | tr -d '\n')"
20+
echo "script_b64=$SCRIPT_B64" >> "$GITHUB_OUTPUT"
2821
2922
- name: Deploy
3023
uses: appleboy/ssh-action@master
@@ -38,8 +31,6 @@ jobs:
3831
script: |
3932
set -e
4033
SCRIPT_PATH="/tmp/deploy.sh"
41-
if [ ! -f "$SCRIPT_PATH" ]; then
42-
SCRIPT_PATH="/tmp/scripts/stage/deploy.sh"
43-
fi
34+
printf '%s' '${{ steps.deploy_script.outputs.script_b64 }}' | base64 -d > "$SCRIPT_PATH"
4435
chmod +x "$SCRIPT_PATH"
4536
bash "$SCRIPT_PATH"

0 commit comments

Comments
 (0)