Skip to content

Commit

Permalink
Create deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
hepplerj authored Nov 21, 2024
1 parent e614f58 commit 31b04ea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env sh

# Create the .ssh directory on the runner. Used to store
# the ssh key for authentication
export SSHDIR="$HOME/.ssh"
mkdir -p "$SSHDIR"

# Copy the ssh key from the secrets store into the .ssh directory
# and assign the correct permissions
echo "$ACTIONS_DEPLOY_KEY" > "$SSHDIR/key"
chmod 600 "$SSHDIR/key"

# Setup a variable to pass to ssh for the connection to the server
export SERVER_DEPLOY_STRING="$SSH_USERNAME@$SERVER_ADDRESS:$SERVER_DESTINATION"

# Change to the public directory and rsync everything to the
# documents location for the web server on my server
cd "$GITHUB_WORKSPACE/public" || exit 1
rsync --dry-run --omit-dir-times --checksum -avz --itemize-changes --delete "ssh -i $SSHDIR/key -o StrictHostKeyChecking=no -p $SSH_PORT" . "$SERVER_DEPLOY_STRING"

0 comments on commit 31b04ea

Please sign in to comment.