All checks were successful
Remote Deployment Pipeline / Prepare Context (push) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (push) Successful in 42s
Remote Deployment Pipeline / Deploy (Dev/Preview) (push) Has been skipped
Remote Deployment Pipeline / Cleanup Preview (push) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (push) Successful in 42s
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [appleboy/ssh-action](https://github.com/appleboy/ssh-action) | action | minor | `v1.0.3` -> `v1.2.4` | --- ### Release Notes <details> <summary>appleboy/ssh-action (appleboy/ssh-action)</summary> ### [`v1.2.4`](https://github.com/appleboy/ssh-action/releases/tag/v1.2.4) [Compare Source](https://github.com/appleboy/ssh-action/compare/v1.2.3...v1.2.4) #### Changelog ##### Enhancements - [`4e3535e`](4e3535e14e): chore: bump default DRONE\_SSH\_VERSION to 1.8.2 ([@​appleboy](https://github.com/appleboy)) ##### Build process updates - [`823bd89`](823bd89e13): ci: trigger GitHub Actions workflows only on version tags ([@​appleboy](https://github.com/appleboy)) ##### Documentation updates - [`652a0be`](652a0bee3c): docs: update CI documentation and workflow references ([@​appleboy](https://github.com/appleboy)) - [`f6208e0`](f6208e096d): docs: document and demonstrate capturing and using command output ([@​appleboy](https://github.com/appleboy)) ### [`v1.2.3`](https://github.com/appleboy/ssh-action/releases/tag/v1.2.3) [Compare Source](https://github.com/appleboy/ssh-action/compare/v1.2.2...v1.2.3) #### Changelog ##### Features - [`20d5c5b`](20d5c5bbc9): feat: add configurable curl insecure flag to GitHub action ([@​appleboy](https://github.com/appleboy)) ##### Bug fixes - [`170eebb`](170eebb2ee): fix: enhance binary download flow with robust error handling ([#​394](https://github.com/appleboy/ssh-action/issues/394)) ([@​appleboy](https://github.com/appleboy)) ##### Enhancements - [`b27b9f8`](b27b9f8968): chore: refactor system to improve efficiency and update API usage ([@​appleboy](https://github.com/appleboy)) - [`0e19dd9`](0e19dd962d): chore: improve robustness and consistency across multiple scripts ([@​appleboy](https://github.com/appleboy)) ##### Refactor - [`b6690ee`](b6690ee817): refactor: improve error handling and code readability across scripts ([#​374](https://github.com/appleboy/ssh-action/issues/374)) ([@​appleboy](https://github.com/appleboy)) ##### Build process updates - [`2b3c650`](2b3c6504b3): ci: unify and enhance GitHub workflow configurations ([@​appleboy](https://github.com/appleboy)) - [`ffd1eec`](ffd1eec364): ci: add workflow step for multi-command SSH testing ([#​386](https://github.com/appleboy/ssh-action/issues/386)) ([@​appleboy](https://github.com/appleboy)) - [`53f5c5c`](53f5c5cedf): ci: add automated Trivy security scanning via GitHub Actions ([@​appleboy](https://github.com/appleboy)) ##### Documentation updates - [`52a1840`](52a1840ca6): docs: update SSH action version to v1 in all README files ([#​372](https://github.com/appleboy/ssh-action/issues/372)) ([@​appleboy](https://github.com/appleboy)) - [`689de3c`](689de3cf64): docs: improve CLI messaging and error clarity for users ([@​appleboy](https://github.com/appleboy)) - [`9ca1cd2`](9ca1cd2174): docs: document the new `curl_insecure` configuration option ([@​appleboy](https://github.com/appleboy)) - [`bd83ba7`](bd83ba7e2b): docs: document and configure drone-ssh version usage ([#​381](https://github.com/appleboy/ssh-action/issues/381)) ([@​appleboy](https://github.com/appleboy)) - [`b80f638`](b80f638dc4): docs: rewrite and unify documentation across all supported languages ([@​appleboy](https://github.com/appleboy)) - [`c7fbbc9`](c7fbbc9208): docs: add table of contents to multilingual README files ([@​appleboy](https://github.com/appleboy)) - [`4d84f05`](4d84f0522a): docs: revamp and unify multi-language readme documentation ([@​appleboy](https://github.com/appleboy)) - [`8f3cc07`](8f3cc07719): docs: add comprehensive tables of contents to all README files ([@​appleboy](https://github.com/appleboy)) - [`8745f95`](8745f9583c): docs: restructure and clarify parameter documentation across all readmes ([@​appleboy](https://github.com/appleboy)) - [`57f6f35`](57f6f3556d): docs(readme): better wording for script\_path property ([#​387](https://github.com/appleboy/ssh-action/issues/387)) ([@​kontur](https://github.com/kontur)) - [`3ca8a7c`](3ca8a7c535): docs: clarify script\_path usage in Chinese remote execution docs ([@​appleboy](https://github.com/appleboy)) - [`c680069`](c680069d84): docs: add comprehensive documentation for project setup and usage ([@​appleboy](https://github.com/appleboy)) - [`91f3272`](91f3272fc5): docs: add Trivy security scan badge to all documentation ([@​appleboy](https://github.com/appleboy)) ### [`v1.2.2`](https://github.com/appleboy/ssh-action/releases/tag/v1.2.2) [Compare Source](https://github.com/appleboy/ssh-action/compare/v1.2.1...v1.2.2) #### Changelog ##### Enhancements - [`b0a8f32`](b0a8f324e1): chore: bump DRONE\_SSH version to 1.8.1 ([@​appleboy](https://github.com/appleboy)) - [`2ead5e3`](2ead5e3657): chore: update action version across workflows and documentation ([@​appleboy](https://github.com/appleboy)) ##### Documentation updates - [`9817ef4`](9817ef4a17): docs(readme): set -e for script\_stop functionality ([#​368](https://github.com/appleboy/ssh-action/issues/368)) ([@​Setland34](https://github.com/Setland34)) - [`9273705`](92737056c0): docs: improve documentation and defaults for execution and security ([@​appleboy](https://github.com/appleboy)) - [`d99ccf8`](d99ccf8c09): docs: improve documentation clarity and consistency ([@​appleboy](https://github.com/appleboy)) - [`01a5359`](01a53594eb): docs: enhance language support and improve documentation clarity ([@​appleboy](https://github.com/appleboy)) - [`48992f2`](48992f2e2c): docs: prioritize English in language selection options ([@​appleboy](https://github.com/appleboy)) - [`039c9e0`](039c9e07bb): docs: update README with private key instructions in multiple languages ([@​appleboy](https://github.com/appleboy)) - [`a0a0326`](a0a0326939): docs: clarify parameter descriptions for improved documentation ([@​appleboy](https://github.com/appleboy)) ### [`v1.2.1`](https://github.com/appleboy/ssh-action/releases/tag/v1.2.1) [Compare Source](https://github.com/appleboy/ssh-action/compare/v1.2.0...v1.2.1) #### Changelog ##### Features - [`102c0d2`](102c0d2e5f): feat: capture stdout and store as output ([#​287](https://github.com/appleboy/ssh-action/issues/287)) ([@​GammaGames](https://github.com/GammaGames)) ##### Enhancements - [`8fdfeb0`](8fdfeb034e): chore(github): update `appleboy/ssh-action` to version `v1.2.0` across workflows ([@​appleboy](https://github.com/appleboy)) - [`43d4ebb`](43d4ebbb72): chore: Add test to stable workflow for script\_path ([#​347](https://github.com/appleboy/ssh-action/issues/347)) ([@​kyle-leonhard](https://github.com/kyle-leonhard)) - [`8faa842`](8faa84277b): chore: standardize formatting and update dependencies in workflows ([@​appleboy](https://github.com/appleboy)) ##### Build process updates - [`1c1ad10`](1c1ad10f6d): ci(action): remove script stop functionality from project ([#​350](https://github.com/appleboy/ssh-action/issues/350)) ([@​appleboy](https://github.com/appleboy)) - [`e13c387`](e13c387332): ci(action): display an environment variable with special characters ([#​351](https://github.com/appleboy/ssh-action/issues/351)) ([@​appleboy](https://github.com/appleboy)) - [`66aa4d3`](66aa4d343b): ci: add SSH testing job to GitHub Actions workflow ([#​355](https://github.com/appleboy/ssh-action/issues/355)) ([@​appleboy](https://github.com/appleboy)) - [`86aa40d`](86aa40ddb7): ci: add SSH server testing to GitHub Actions workflow ([@​appleboy](https://github.com/appleboy)) ##### Documentation updates - [`a8952eb`](a8952ebe2a): docs(readme): update documentation for GitHub Actions and Docker support ([@​appleboy](https://github.com/appleboy)) - [`cec69ef`](cec69ef231): docs(readme): standardize terminology and capitalization across project ([@​appleboy](https://github.com/appleboy)) - [`a9e2fdf`](a9e2fdf08d): docs(readme): improve README structure and add new input variables ([@​appleboy](https://github.com/appleboy)) - [`6137f73`](6137f733fb): docs: improve project documentation and organization ([@​appleboy](https://github.com/appleboy)) - [`b76e617`](b76e6173e8): docs(readme): standardize and format README files across languages ([@​appleboy](https://github.com/appleboy)) - [`4853185`](48531853a7): docs(readme): refactor README files to improve language link structure ([@​appleboy](https://github.com/appleboy)) - [`49751ff`](49751ff516): docs: standardize `script_file` naming to `script_path` in documentation ([#​360](https://github.com/appleboy/ssh-action/issues/360)) ([@​appleboy](https://github.com/appleboy)) ### [`v1.2.0`](https://github.com/appleboy/ssh-action/releases/tag/v1.2.0) [Compare Source](https://github.com/appleboy/ssh-action/compare/v1.1.0...v1.2.0) #### Changelog ##### Features - [`703ffa3`](703ffa3c1e): feat(actions): enhance system performance and API integration ([@​appleboy](https://github.com/appleboy)) ##### Bug fixes - [`3f14168`](3f1416813d): fix: typo in success message ([#​340](https://github.com/appleboy/ssh-action/issues/340)) ([@​1ukastesar](https://github.com/1ukastesar)) - [`25259c3`](25259c3d50): fix: refactor and enhance API and testing infrastructure ([@​appleboy](https://github.com/appleboy)) ##### Enhancements - [`bb32884`](bb32884d53): chore: enhance CI/CD workflows and documentation formatting ([@​appleboy](https://github.com/appleboy)) - [`362a7f1`](362a7f1677): chore: support running commands from a file ([#​341](https://github.com/appleboy/ssh-action/issues/341)) ([@​kyle-leonhard](https://github.com/kyle-leonhard)) - [`176437b`](176437b548): chore: refactor codebase for improved consistency and performance ([@​appleboy](https://github.com/appleboy)) ##### Refactor - [`bf84378`](bf84378588): refactor: refactor codebase and improve API performance ([@​appleboy](https://github.com/appleboy)) ##### Build process updates - [`2763143`](2763143a97): ci(script): enhance CI workflows and API integration ([@​appleboy](https://github.com/appleboy)) - [`8b84eae`](8b84eaec3a): ci(script): improve CI robustness and coverage across environments ([@​appleboy](https://github.com/appleboy)) ##### Documentation updates - [`ab698e5`](ab698e59d8): docs(readme): enhance network protocol support and testing ([@​appleboy](https://github.com/appleboy)) - [`7eaf766`](7eaf76671a): docs(readme): update SSH action and enhance Chinese README files ([@​appleboy](https://github.com/appleboy)) ### [`v1.1.0`](https://github.com/appleboy/ssh-action/releases/tag/v1.1.0) [Compare Source](https://github.com/appleboy/ssh-action/compare/v1.0.3...v1.1.0) #### Changelog ##### Bug fixes - [`0c7561b`](0c7561b1a3): fix: switch to SSH key authentication for security ([@​appleboy](https://github.com/appleboy)) ##### Enhancements - [`9b978f0`](9b978f09f2): chore: update SSH action version in README files ([@​appleboy](https://github.com/appleboy)) - [`1991c55`](1991c553ec): chore(file): update target file ([@​appleboy](https://github.com/appleboy)) - [`aa293c2`](aa293c24bb): chore: optimize system configuration and API integration ([@​appleboy](https://github.com/appleboy)) - [`036cad7`](036cad7df7): chore: update drone-ssh to version 1.7.7 ([@​appleboy](https://github.com/appleboy)) - [`8b60782`](8b6078208d): chore(cli): enhance version handling and testing mechanisms ([@​appleboy](https://github.com/appleboy)) - [`5ade826`](5ade826485): chore: improve CLI reliability and version visibility ([@​appleboy](https://github.com/appleboy)) - [`eaeb069`](eaeb06998d): chore(cli): enhance curl command with silent mode and redirects ([@​appleboy](https://github.com/appleboy)) - [`58164d0`](58164d0dc2): chore: remove Dockerfile and related configurations ([@​appleboy](https://github.com/appleboy)) ##### Refactor - [`da612c8`](da612c8015): refactor: optimize CI pipeline for faster execution ([@​appleboy](https://github.com/appleboy)) ##### Build process updates - [`c781418`](c78141851a): ci: enhance GitHub Actions for IPv6 and flexibility ([#​303](https://github.com/appleboy/ssh-action/issues/303)) ([@​appleboy](https://github.com/appleboy)) - [`d2d6858`](d2d6858859): ci: enhance GitHub workflow for SSH actions and deployments ([@​appleboy](https://github.com/appleboy)) - [`551964e`](551964ebda): ci: optimize GitHub Actions workflow configuration ([@​appleboy](https://github.com/appleboy)) - [`f916346`](f916346256): ci: refactor CI workflow and improve robustness ([#​320](https://github.com/appleboy/ssh-action/issues/320)) ([@​appleboy](https://github.com/appleboy)) - [`aabaf12`](aabaf1254d): ci: add bug report template ([@​appleboy](https://github.com/appleboy)) - [`c8594ae`](c8594ae37d): ci: implement GitHub Actions for remote SSH execution ([@​appleboy](https://github.com/appleboy)) - [`40aad53`](40aad53c5a): ci: add SSH authentication setup for GitHub Actions ([@​appleboy](https://github.com/appleboy)) - [`0b0e770`](0b0e77098a): ci: optimize and enhance SSH server workflow ([@​appleboy](https://github.com/appleboy)) - [`977b74a`](977b74a12d): ci: enhance CI workflow with SSH job and optimizations ([@​appleboy](https://github.com/appleboy)) - [`2eeab5b`](2eeab5bdba): ci: refactor GitHub Actions key management ([@​appleboy](https://github.com/appleboy)) - [`acd41e5`](acd41e5091): ci: enhance SSH job testing with varied key/password scenarios ([@​appleboy](https://github.com/appleboy)) - [`f05aefe`](f05aefe351): ci: enhance SSH action configuration and error handling ([@​appleboy](https://github.com/appleboy)) - [`e40b597`](e40b597081): ci: add GitHub Actions job for SSH key passphrase support ([@​appleboy](https://github.com/appleboy)) - [`15b64dc`](15b64dc891): ci: enhance CI pipeline with SSH key handling improvements ([@​appleboy](https://github.com/appleboy)) - [`a39b3cc`](a39b3cce7d): ci: enhance CI/CD pipeline with SSH command execution ([@​appleboy](https://github.com/appleboy)) - [`815c574`](815c5743ac): ci: enhance deployment with multi-host SSH action ([@​appleboy](https://github.com/appleboy)) - [`378323e`](378323e4c8): ci: add multi-server support to CI workflow ([@​appleboy](https://github.com/appleboy)) - [`fc1c1fc`](fc1c1fce51): ci: add GitHub Actions job for [`ed25519`](https://github.com/appleboy/ssh-action/commit/ed25519) key support ([@​appleboy](https://github.com/appleboy)) - [`f0e5a23`](f0e5a23d53): ci: add environment variable handling in GitHub Actions ([@​appleboy](https://github.com/appleboy)) - [`9c32aa6`](9c32aa61f8): ci: refactor workflows and API integrations ([@​appleboy](https://github.com/appleboy)) - [`97f8d75`](97f8d752b5): ci: enable root access in CI pipeline ([@​appleboy](https://github.com/appleboy)) - [`5a8776f`](5a8776fd15): ci: switch to password authentication in GitHub workflow ([@​appleboy](https://github.com/appleboy)) - [`b6941ae`](b6941ae5d5): ci: refactor codebase and optimize performance ([@​appleboy](https://github.com/appleboy)) - [`43895f2`](43895f2cd5): ci: refactor SSH testing workflows and job configurations ([@​appleboy](https://github.com/appleboy)) - [`06fa62e`](06fa62e61c): ci: rename the workflow files. ([@​appleboy](https://github.com/appleboy)) - [`b4a07ca`](b4a07ca594): ci: enhance GitHub Actions with secret variable support ([#​330](https://github.com/appleboy/ssh-action/issues/330)) ([@​appleboy](https://github.com/appleboy)) - [`25ce8cb`](25ce8cbbcb): ci: implement automated release workflow with GoReleaser ([@​appleboy](https://github.com/appleboy)) ##### Documentation updates - [`8a779a5`](8a779a5b1a): docs: describe true usage of allenvs parameter ([#​301](https://github.com/appleboy/ssh-action/issues/301)) ([@​hussu010](https://github.com/hussu010)) - [`fe44be0`](fe44be0b96): docs: improve documentation and CI robustness ([@​appleboy](https://github.com/appleboy)) - [`dd0f09c`](dd0f09ca07): docs: improve README clarity and completeness ([@​appleboy](https://github.com/appleboy)) - [`71d43ea`](71d43ea0f7): docs: improve documentation and testing configurations ([@​appleboy](https://github.com/appleboy)) - [`28428a1`](28428a13f5): docs: improve cross-platform clipboard support for key copying ([@​appleboy](https://github.com/appleboy)) - [`d732991`](d732991ab0): docs(lang): README.zh-cn Document ([#​332](https://github.com/appleboy/ssh-action/issues/332)) ([@​astralwaveio](https://github.com/astralwaveio)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4yNi4xMSIsInVwZGF0ZWRJblZlciI6IjQyLjI2LjExIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://gitea.kovagoadi.hu/kovagoadi.hu/traefik/pulls/16 Co-authored-by: Renovate Bot <renovate@kovagoadi.hu> Co-committed-by: Renovate Bot <renovate@kovagoadi.hu>
149 lines
5.6 KiB
YAML
149 lines
5.6 KiB
YAML
name: Remote Deployment Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, closed]
|
|
|
|
env:
|
|
# --- PATH CONFIGURATION ---
|
|
REMOTE_DEPLOY_PATH: /var/app/traefik/test
|
|
REMOTE_PROD_PATH: /var/app/traefik/prod
|
|
REMOTE_STAGING_PATH: /var/app/traefik/staging
|
|
|
|
# --- SECRETS ---
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_PORT: ${{ secrets.SSH_PORT || 22 }}
|
|
|
|
jobs:
|
|
# ------------------------------------------------------------------
|
|
# STAGE 1: PREPARE CONTEXT
|
|
# ------------------------------------------------------------------
|
|
prepare_context:
|
|
name: Prepare Context
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
pr_path: ${{ steps.calc.outputs.pr_path }}
|
|
steps:
|
|
- id: calc
|
|
name: Prepare Context
|
|
run: |
|
|
REPO_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f 2)
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
echo "pr_path=${REMOTE_DEPLOY_PATH}/${REPO_NAME}-pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
# ------------------------------------------------------------------
|
|
# STAGE 2: DEPLOY PREVIEW (DEV)
|
|
# ------------------------------------------------------------------
|
|
deploy_preview:
|
|
name: Deploy (Dev/Preview)
|
|
runs-on: ubuntu-latest
|
|
needs: [prepare_context]
|
|
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Deploy via Rsync & Docker
|
|
uses: easingthemes/ssh-deploy@16bb35ed0b6e568fa7554ebdf990fdc4c046b549 # v5.0.0
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ env.SSH_PRIVATE_KEY }}
|
|
REMOTE_HOST: ${{ env.SSH_HOST }}
|
|
REMOTE_USER: ${{ env.SSH_USER }}
|
|
REMOTE_PORT: ${{ env.SSH_PORT }}
|
|
TARGET: ${{ needs.prepare_context.outputs.pr_path }}
|
|
# Exclude git internals to save bandwidth
|
|
EXCLUDE: ".git/, .github/"
|
|
# 1. Create directory first
|
|
SCRIPT_BEFORE: |
|
|
mkdir -p ${{ needs.prepare_context.outputs.pr_path }}
|
|
# 2. Run Docker Compose after sync
|
|
SCRIPT_AFTER: |
|
|
set -e
|
|
cd ${{ needs.prepare_context.outputs.pr_path }}
|
|
docker compose --env-file dev.env -f docker-compose.yaml up -d --build --remove-orphans
|
|
|
|
# ------------------------------------------------------------------
|
|
# STAGE 3: DEPLOY STAGING
|
|
# ------------------------------------------------------------------
|
|
deploy_staging:
|
|
name: Deploy (Staging)
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Deploy via Rsync & Docker
|
|
uses: easingthemes/ssh-deploy@16bb35ed0b6e568fa7554ebdf990fdc4c046b549 # v5.0.0
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ env.SSH_PRIVATE_KEY }}
|
|
REMOTE_HOST: ${{ env.SSH_HOST }}
|
|
REMOTE_USER: ${{ env.SSH_USER }}
|
|
REMOTE_PORT: ${{ env.SSH_PORT }}
|
|
TARGET: ${{ env.REMOTE_STAGING_PATH }}
|
|
EXCLUDE: ".git/, .github/"
|
|
SCRIPT_BEFORE: |
|
|
mkdir -p ${{ env.REMOTE_STAGING_PATH }}
|
|
SCRIPT_AFTER: |
|
|
set -e
|
|
cd ${{ env.REMOTE_STAGING_PATH }}
|
|
docker compose --env-file staging.env -f docker-compose.yaml up -d --build --remove-orphans
|
|
|
|
# ------------------------------------------------------------------
|
|
# STAGE 4: DEPLOY PRODUCTION
|
|
# ------------------------------------------------------------------
|
|
deploy_prod:
|
|
name: Deploy (Production)
|
|
runs-on: ubuntu-latest
|
|
needs: [deploy_staging]
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Deploy via Rsync & Docker
|
|
uses: easingthemes/ssh-deploy@16bb35ed0b6e568fa7554ebdf990fdc4c046b549 # v5.0.0
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ env.SSH_PRIVATE_KEY }}
|
|
REMOTE_HOST: ${{ env.SSH_HOST }}
|
|
REMOTE_USER: ${{ env.SSH_USER }}
|
|
REMOTE_PORT: ${{ env.SSH_PORT }}
|
|
TARGET: ${{ env.REMOTE_PROD_PATH }}
|
|
EXCLUDE: ".git/, .github/"
|
|
SCRIPT_BEFORE: |
|
|
mkdir -p ${{ env.REMOTE_PROD_PATH }}
|
|
SCRIPT_AFTER: |
|
|
set -e
|
|
cd ${{ env.REMOTE_PROD_PATH }}
|
|
docker compose --env-file prod.env -f docker-compose.yaml -f docker-compose.prod.yaml up -d --build --remove-orphans
|
|
|
|
# ------------------------------------------------------------------
|
|
# CLEANUP (Using appleboy/ssh-action for pure command execution)
|
|
# ------------------------------------------------------------------
|
|
cleanup:
|
|
name: Cleanup Preview
|
|
runs-on: ubuntu-latest
|
|
needs: [prepare_context]
|
|
if: github.event_name == 'pull_request' && (github.event.action == 'closed' || github.event.pull_request.merged == true)
|
|
steps:
|
|
- name: Remove Remote Environment
|
|
uses: appleboy/ssh-action@823bd89e131d8d508129f9443cad5855e9ba96f0 # v1.2.4
|
|
with:
|
|
host: ${{ env.SSH_HOST }}
|
|
username: ${{ env.SSH_USER }}
|
|
key: ${{ env.SSH_PRIVATE_KEY }}
|
|
port: ${{ env.SSH_PORT }}
|
|
script: |
|
|
TARGET="${{ needs.prepare_context.outputs.pr_path }}"
|
|
if [ -d "$TARGET" ]; then
|
|
cd "$TARGET"
|
|
docker compose down -v || true
|
|
cd ..
|
|
rm -rf "$TARGET"
|
|
echo "Cleanup successful"
|
|
else
|
|
echo "Directory not found, skipping."
|
|
fi |