Enable automatic ABSDEV deployment
Deploy ABSDEV Production / Deploy Laravel to ABSDEV (push) Successful in 1m33s
Deploy ABSDEV Production / Deploy Laravel to ABSDEV (push) Successful in 1m33s
This commit is contained in:
@@ -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 \
|
||||
[email protected] \
|
||||
'hostname && test -L /opt/laravel-sites/absdev-net/deploy/current'
|
||||
|
||||
"$RUNNER_TEMP/deployer/vendor/bin/dep" deploy prod \
|
||||
--no-interaction
|
||||
Reference in New Issue
Block a user