Skip to content

ci: update SSH action version and enhance deployment script#5

Merged
Adjanour merged 1 commit intomasterfrom
chore/ci-changes
Feb 25, 2026
Merged

ci: update SSH action version and enhance deployment script#5
Adjanour merged 1 commit intomasterfrom
chore/ci-changes

Conversation

@Adjanour
Copy link
Copy Markdown
Contributor

This pull request updates the deployment workflow to improve reliability and flexibility during SSH-based deployments. The most important changes include updating the action version, adding error handling, and making the deployment directory configurable.

Deployment workflow improvements:

  • Updated the appleboy/ssh-action to version v1.0.3 for improved stability and compatibility.
  • Added set -e to the deployment script to ensure the process stops on errors, preventing partial deployments.
  • Introduced configuration variables (REPO_NAME, APP_DIR, BRANCH) to make the deployment directory and branch dynamic and easier to manage.
  • Changed the deployment directory to /srv/apps/$REPO_NAME and ensured it is created if it does not exist, improving flexibility for different environments.

@Adjanour Adjanour requested a review from Orcta-tech February 25, 2026 07:26
@Adjanour Adjanour self-assigned this Feb 25, 2026
Copilot AI review requested due to automatic review settings February 25, 2026 07:26
@Adjanour Adjanour merged commit f9bd976 into master Feb 25, 2026
3 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub Actions deployment workflow to improve SSH-based deployments by pinning the SSH action version and making the remote deploy path configurable via script variables.

Changes:

  • Bumped appleboy/ssh-action from v1 to v1.0.3.
  • Added set -e and introduced REPO_NAME / APP_DIR / BRANCH variables in the remote deployment script.
  • Changed the deployment directory to /srv/apps/$REPO_NAME and ensured it is created.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Configuration
REPO_NAME="orcta-stack"
APP_DIR="/srv/apps/$REPO_NAME"
BRANCH="${{ github.ref_name }}"
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BRANCH is defined from github.ref_name but never used in the script. This adds confusion about what is actually being deployed; either use it (e.g., to check out/pull the correct branch on the server) or remove it.

Suggested change
BRANCH="${{ github.ref_name }}"

Copilot uses AI. Check for mistakes.
# Create app directory if it doesn't exist
mkdir -p "$APP_DIR"
cd "$APP_DIR"

Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script now creates and cds into $APP_DIR, but it doesn't ensure that required deployment files (e.g. docker-compose.prod.yml referenced later) exist in that directory. On a fresh host (or if the directory is empty), the subsequent docker compose -f docker-compose.prod.yml ... commands will fail; consider adding a guard with a clear error (or cloning/pulling the repo into $APP_DIR as part of the script).

Suggested change
# Ensure required deployment file exists
if [ ! -f docker-compose.prod.yml ]; then
echo "Error: docker-compose.prod.yml not found in $APP_DIR. Ensure the deployment repository is cloned and files are present before running this workflow."
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +77
APP_DIR="/srv/apps/$REPO_NAME"
BRANCH="${{ github.ref_name }}"

# Create app directory if it doesn't exist
mkdir -p "$APP_DIR"
cd "$APP_DIR"
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the deploy path to /srv/apps/... assumes the SSH user has permission to create/write there. If ${{ secrets.VPS_USER }} is not root (or doesn’t have the right ACLs), mkdir -p "$APP_DIR" will fail; consider using a path that matches the user's permissions, or explicitly using sudo after confirming the runner user can elevate.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants