1
Fork 0

Stop relying on home dir

This commit is contained in:
ljoonal 2023-10-13 00:44:09 +03:00
parent 931771ebaa
commit 78b42f686c
No known key found for this signature in database

View file

@ -33,9 +33,8 @@ runs:
export DEPLOY_ID="${DEPLOY_ID}_$(date +%s)"
# Setup SSH
echo "$DEPLOY_SSH_KEY" > "priv.key" && chmod 0600 "priv.key"
mkdir -p "$HOME/.ssh"
echo "$DEPLOY_IDENTITY" > "$HOME/.ssh/known_hosts"
chmod 600 "$HOME/.ssh/known_hosts"
echo "$DEPLOY_IDENTITY" > "known_hosts"
chmod 600 "known_hosts"
# Deploy script generation
echo "mkdir upload/$DEPLOY_ID" > deploy.txt
echo "put -R $DEPLOY_FOLDER/* upload/$DEPLOY_ID" >> deploy.txt
@ -44,7 +43,7 @@ runs:
# Actual deploy
echo "$DEPLOY_ID" > build_number.txt
echo "Uploading $DEPLOY_ID from $DEPLOY_FOLDER"
sftp -b deploy.txt -i "priv.key" -oRequestTTY=no -P "$DEPLOY_PORT" "$DEPLOY_USERNAME@$DEPLOY_HOST"
sftp -b deploy.txt -i "priv.key" -o UserKnownHostsFile="known_hosts" -oRequestTTY=no -P "$DEPLOY_PORT" "$DEPLOY_USERNAME@$DEPLOY_HOST"
env:
DEPLOY_ID: ${{ inputs.deploy-id }}
DEPLOY_SSH_KEY: ${{ inputs.ssh-key }}
@ -55,4 +54,4 @@ runs:
DEPLOY_FOLDER: ${{ inputs.folder }}
- name: Cleanup
if: "always()"
run: rm "priv.key"
run: rm priv.key known_hosts