From 1157cb4f4cdfd47d3b45a05774aab95ddb5066e7 Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Fri, 20 Nov 2026 10:25:44 +0000 Subject: [PATCH] Enable automatic ABSDEV deployment --- .gitea/workflows/deploy.yml | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..55120ae --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,68 @@ +name: Deploy ABSDEV Production + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +jobs: + deploy: + name: Deploy Laravel to ABSDEV + runs-on: ubuntu-latest + timeout-minutes: 45 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install PHP and deployment dependencies + run: | + set -euo pipefail + sudo apt-get update + sudo apt-get install -y \ + php-cli php-mbstring php-xml \ + composer git openssh-client unzip + + - name: Install Deployer 8.0.5 + run: | + set -euo pipefail + mkdir -p "$RUNNER_TEMP/deployer" + composer --working-dir="$RUNNER_TEMP/deployer" \ + require deployer/deployer:8.0.5 \ + --no-interaction --no-progress --no-scripts + "$RUNNER_TEMP/deployer/vendor/bin/dep" --version + + - name: Validate Deployer configuration + run: | + set -euo pipefail + php -l deploy.php + "$RUNNER_TEMP/deployer/vendor/bin/dep" tree deploy + + - name: Configure deployment SSH key + env: + DEPLOY_SSH_KEY: ${{ secrets.ABSDEV_DEPLOY_SSH_KEY }} + DEPLOY_KNOWN_HOSTS: ${{ secrets.ABSDEV_KNOWN_HOSTS }} + run: | + set -euo pipefail + test -n "$DEPLOY_SSH_KEY" + test -n "$DEPLOY_KNOWN_HOSTS" + + mkdir -p "$HOME/.ssh" + chmod 700 "$HOME/.ssh" + printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts" + chmod 600 "$HOME/.ssh/known_hosts" + + eval "$(ssh-agent -s)" + printf '%s\n' "$DEPLOY_SSH_KEY" | tr -d '\r' | ssh-add - + + ssh -o BatchMode=yes \ + -o StrictHostKeyChecking=yes \ + mag@217.154.36.101 \ + 'hostname && test -L /opt/laravel-sites/absdev-net/deploy/current' + + "$RUNNER_TEMP/deployer/vendor/bin/dep" deploy prod \ + --no-interaction