From 71a9e1b06bab56ff3018488a0d0a15f0b251952a Mon Sep 17 00:00:00 2001 From: hermes Date: Mon, 31 Aug 2026 14:39:18 +0000 Subject: [PATCH 1/4] feat(actions): add brencher reusable GitHub Action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds .github/actions/brencher/action.yml — a composite reusable GitHub Action that builds a Docker image, pushes it to a registry, and deploys a Docker Compose stack to a Swarm cluster via SSH. Designed to be invoked from per-repo workflows that watch for PR approval events; the caller supplies registry credentials, swarm manager SSH details, and the stack / image names. Companion PR in admin/reverseproxy wires this action into the torrserv_proxy stack as the first end-to-end pilot. --- .github/actions/brencher/README.md | 50 ++++++++++++++++++ .github/actions/brencher/action.yml | 81 +++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 .github/actions/brencher/README.md create mode 100644 .github/actions/brencher/action.yml diff --git a/.github/actions/brencher/README.md b/.github/actions/brencher/README.md new file mode 100644 index 0000000..c65e0d2 --- /dev/null +++ b/.github/actions/brencher/README.md @@ -0,0 +1,50 @@ +# brencher action + +Reusable GitHub Action that builds a Docker image, pushes it to a registry, and +deploys a Docker Compose stack to a Swarm cluster. + +## Usage + +```yaml +- uses: admin/brencher/.github/actions/brencher@main + with: + registry: registry.example.com + image_name: admin/my-stack + stack_name: my_stack + compose_path: docker-compose.yml + deploy_branch: main + registry_username: ${{ secrets.REGISTRY_USERNAME }} + registry_password: ${{ secrets.REGISTRY_PASSWORD }} + swarm_manager_host: ${{ secrets.SWARM_MANAGER_HOST }} + swarm_ssh_user: ${{ secrets.SWARM_SSH_USER }} + swarm_ssh_key: ${{ secrets.SWARM_SSH_KEY }} +``` + +## Inputs + +| Input | Required | Default | Description | +|-------|----------|---------|-------------| +| `registry` | yes | – | Docker registry hostname | +| `image_name` | yes | – | Image name (e.g. `admin/reverseproxy`) | +| `stack_name` | yes | – | Docker stack name for `docker stack deploy` | +| `compose_path` | no | `docker-compose.yml` | Path to compose file relative to repo root | +| `deploy_branch` | no | `main` | Branch containing the merged-deploy commit on the swarm manager | +| `registry_username` | yes | – | Registry username | +| `registry_password` | yes | – | Registry password | +| `swarm_manager_host` | yes | – | Swarm manager SSH host | +| `swarm_ssh_user` | yes | – | Swarm manager SSH user | +| `swarm_ssh_key` | yes | – | Swarm manager SSH private key | + +## How it works + +1. Resolves the image tag from the current commit SHA: `auto-`. +2. Logs in to the registry. +3. Builds the image with BuildKit, pushes it to the registry with the + `auto-` and `latest` tags, using registry-based cache. +4. SSHes to the swarm manager, fetches the deploy branch, then runs + `docker stack deploy --prune --resolve-image-always` against the compose + file in the repo. + +The deploy branch is fetched and reset to its tip on the swarm manager, so the +compose file the manager sees is always the latest version from the deploy +branch. diff --git a/.github/actions/brencher/action.yml b/.github/actions/brencher/action.yml new file mode 100644 index 0000000..9149521 --- /dev/null +++ b/.github/actions/brencher/action.yml @@ -0,0 +1,81 @@ +name: brencher +description: Build, push, and deploy a Docker Compose stack from a watched repo +inputs: + registry: + description: Docker registry hostname + required: true + image_name: + description: Image name (e.g. admin/reverseproxy) + required: true + stack_name: + description: Docker stack name for `docker stack deploy` + required: true + compose_path: + description: Path to docker-compose.yml relative to repo root + required: false + default: docker-compose.yml + deploy_branch: + description: Branch containing the merged-deploy commit + required: false + default: main + registry_username: + description: Registry username + required: true + registry_password: + description: Registry password + required: true + swarm_manager_host: + description: Swarm manager SSH host + required: true + swarm_ssh_user: + description: Swarm manager SSH user + required: true + swarm_ssh_key: + description: Swarm manager SSH private key + required: true + +runs: + using: composite + steps: + - name: Set IMAGE_TAG + id: tag + shell: bash + run: | + if [ -n "${{ github.event.pull_request.head.sha }}" ]; then + echo "value=auto-${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT" + else + echo "value=auto-${{ github.sha }}" >> "$GITHUB_OUTPUT" + fi + + - name: Login to registry + shell: bash + run: | + echo "${{ inputs.registry_password }}" | docker login "${{ inputs.registry }}" -u "${{ inputs.registry_username }}" --password-stdin + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ${{ inputs.registry }}/${{ inputs.image_name }}:${{ steps.tag.outputs.value }} + ${{ inputs.registry }}/${{ inputs.image_name }}:latest + cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.image_name }}:buildcache + cache-to: type=registry,ref=${{ inputs.registry }}/${{ inputs.image_name }}:buildcache,mode=max + + - name: Deploy to swarm + uses: appleboy/drone-ssh-action@v1 + with: + host: ${{ inputs.swarm_manager_host }} + username: ${{ inputs.swarm_ssh_user }} + key: ${{ inputs.swarm_ssh_key }} + script: | + set -e + export IMAGE_TAG=${{ steps.tag.outputs.value }} + cd /opt/brencher-stacks/${{ inputs.stack_name }} + git fetch origin ${{ inputs.deploy_branch }} + git reset --hard origin/${{ inputs.deploy_branch }} + docker stack deploy --prune --resolve-image-always -c ${{ inputs.compose_path }} ${{ inputs.stack_name }} -- 2.54.0 From c46e4015ec507b8ceba494db231285886e339f15 Mon Sep 17 00:00:00 2001 From: hermes Date: Mon, 31 Aug 2026 18:01:52 +0000 Subject: [PATCH 2/4] feat(torrserv_proxy): delegate docker build to GitHub Action Replace the inline DockerComposeBuild step in the torrserv_proxy config with a new GitHubActionTrigger step that POSTs to /api/v1/repos/admin/reverseproxy/actions/workflows/build.yml/dispatches on the commit SHA produced by CheckoutMerged, then polls the run status until completion. CheckoutMerged gets a new push_branch_template knob so it pushes the merge result to 'auto-deploy/torrserv_proxy/' on origin. That branch is what the workflow sees as its ref. DockerSwarmDeploy stays in the pipeline (per Alex: "deploy step leave as is") -- buildDocker is set to None since the image is now produced by the action. New step: backend/steps/github_action.py. Uses BRENCHER_GITEA_TOKEN env var for auth. --- backend/configs/torrserv_proxy.py | 35 +++++---- backend/steps/git.py | 20 ++++- backend/steps/github_action.py | 125 ++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 17 deletions(-) create mode 100644 backend/steps/github_action.py diff --git a/backend/configs/torrserv_proxy.py b/backend/configs/torrserv_proxy.py index 7fe964d..d48796a 100644 --- a/backend/configs/torrserv_proxy.py +++ b/backend/configs/torrserv_proxy.py @@ -1,6 +1,7 @@ from enironment import Environment -from steps.docker import DockerComposeBuild, DockerSwarmCheck, DockerSwarmDeploy +from steps.docker import DockerSwarmCheck, DockerSwarmDeploy from steps.git import GitClone, CheckoutMerged, GitUnmerge +from steps.github_action import GitHubActionTrigger from steps.shared_state import SharedStateHolderInMemory clone = GitClone(remotes=[ @@ -18,25 +19,31 @@ state = SharedStateHolderInMemory(unmerge=unmerge) checkoutMerged = CheckoutMerged(clone, desired_branches=state, - push=False, + push=True, + push_branch_template="auto-deploy/torrserv_proxy/{commit_sha}", git_user_email="rudolfss13@gmail.com", git_user_name="brencher_bot" ) -buildDocker = DockerComposeBuild(clone, - docker_repo_username="", - docker_repo_password="", - docker_compose_path="docker-compose.yml", - docker_repo_url="https://registry.rudolf.keenetic.link", - publish=False, - envs=lambda: { - "version": "auto-" + checkoutMerged.progress().version, - }, - ) +triggerAction = GitHubActionTrigger( + wd=clone, + gitea_base_url="https://gitea.rudolf.keenetic.link", + gitea_token_env="BRENCHER_GITEA_TOKEN", + owner="admin", + repo="reverseproxy", + workflow_file="build.yml", + ref_expr=lambda: checkoutMerged.progress().commit_hash, + inputs=lambda: { + "ref": checkoutMerged.progress().commit_hash, + "image_name": "admin/reverseproxy", + }, + poll_interval_seconds=15, + timeout_seconds=1800, +) deployDocker = DockerSwarmDeploy( wd=clone, - buildDocker=buildDocker, + buildDocker=None, stackChecker=dockerSwarmCheck, envs=lambda: { "version": "auto-" + checkoutMerged.progress().version @@ -53,7 +60,7 @@ torrserv_proxy = Environment( clone, state, checkoutMerged, - buildDocker, + triggerAction, dockerSwarmCheck, unmerge, deployDocker, diff --git a/backend/steps/git.py b/backend/steps/git.py index 8df31d2..11c6df2 100644 --- a/backend/steps/git.py +++ b/backend/steps/git.py @@ -149,6 +149,7 @@ class CheckoutAndMergeResult: remote_branch_name: str | None commit_hash: str version: str + push_branch: str | None = None def _commits_childs(repo: git.Repo) -> Dict[Commit, List[Commit]]: @@ -184,6 +185,7 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]): git_user_email: str, git_user_name: str, push: bool = True, + push_branch_template: str | None = None, **kwargs: Any): super().__init__(**kwargs) self.wd = wd @@ -191,6 +193,7 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]): self.git_user_email = git_user_email self.git_user_name = git_user_name self.push = push + self.push_branch_template = push_branch_template def _find_merge_childs(self, tree: Dict[Commit, List[Commit]], commit: Commit) -> List[Commit]: @@ -307,18 +310,29 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]): remote_branch_name = branch_name if remote_name == 'origin' else ref.name break if self.push and remote_branch_name is None: - auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest() - auto_branch_name = f"auto-{version}" + if self.push_branch_template: + auto_branch_name = self.push_branch_template.format( + commit_sha=repo.head.commit.hexsha, + commit_sha_short=repo.head.commit.hexsha[:8], + version=version, + ) + else: + auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest() + auto_branch_name = f"auto-{version}" logger.info(f"Pushing {repo.head.commit.hexsha} -> {auto_branch_name}") repo.git.push('-f', 'origin', f"HEAD:refs/heads/{auto_branch_name}") remote_branch_name = auto_branch_name + push_branch = auto_branch_name + else: + push_branch = None return CheckoutAndMergeResult( wd=repo_path, remote_branch_name=remote_branch_name, commit_hash=repo.head.commit.hexsha, - version=version + version=version, + push_branch=push_branch, ) diff --git a/backend/steps/github_action.py b/backend/steps/github_action.py new file mode 100644 index 0000000..440f69f --- /dev/null +++ b/backend/steps/github_action.py @@ -0,0 +1,125 @@ +import os +import time +import logging +from dataclasses import dataclass +from typing import Any, Callable, Dict, Optional + +import requests + +from step import AbstractStep + + +logger = logging.getLogger(__name__) + + +@dataclass +class GitHubActionTriggerResult: + run_id: int + conclusion: str + image_tag: Optional[str] + + +class GitHubActionTrigger(AbstractStep[GitHubActionTriggerResult]): + def __init__(self, + wd: AbstractStep, + gitea_base_url: str, + gitea_token_env: str, + owner: str, + repo: str, + workflow_file: str, + ref_expr: Callable[[], str], + inputs: Callable[[], Dict[str, Any]], + poll_interval_seconds: int = 15, + timeout_seconds: int = 1800, + **kwargs: Any): + super().__init__(**kwargs) + self.wd = wd + self.gitea_base_url = gitea_base_url.rstrip("/") + self.gitea_token_env = gitea_token_env + self.owner = owner + self.repo = repo + self.workflow_file = workflow_file + self.ref_expr = ref_expr + self.inputs = inputs + self.poll_interval_seconds = poll_interval_seconds + self.timeout_seconds = timeout_seconds + + def _token(self) -> str: + token = os.environ.get(self.gitea_token_env) + if not token: + raise BaseException(f"Environment variable {self.gitea_token_env} is not set") + return token + + def _url(self, path: str) -> str: + return f"{self.gitea_base_url}/api/v1{path}" + + def _headers(self) -> Dict[str, str]: + return { + "Authorization": f"token {self._token()}", + "Accept": "application/json", + "Content-Type": "application/json", + } + + def _dispatch(self, ref: str, inputs: Dict[str, Any]) -> None: + url = self._url(f"/repos/{self.owner}/{self.repo}/actions/workflows/{self.workflow_file}/dispatches") + resp = requests.post(url, headers=self._headers(), json={"ref": ref, "inputs": inputs}) + if resp.status_code not in (200, 201, 202, 204): + raise BaseException(f"Failed to dispatch action: {resp.status_code} {resp.text}") + + def _latest_run_for_ref(self, ref: str) -> Optional[Dict[str, Any]]: + url = self._url(f"/repos/{self.owner}/{self.repo}/actions/runs") + resp = requests.get(url, headers=self._headers(), params={"ref": ref}) + if resp.status_code != 200: + raise BaseException(f"Failed to list runs: {resp.status_code} {resp.text}") + runs = resp.json().get("workflow_runs", []) + for r in runs: + if r.get("head_branch") == ref or r.get("head_sha") == ref: + return r + return None + + def _get_run(self, run_id: int) -> Dict[str, Any]: + url = self._url(f"/repos/{self.owner}/{self.repo}/actions/runs/{run_id}") + resp = requests.get(url, headers=self._headers()) + if resp.status_code != 200: + raise BaseException(f"Failed to get run {run_id}: {resp.status_code} {resp.text}") + return resp.json() + + def progress(self) -> GitHubActionTriggerResult: + ref = self.ref_expr() + inputs = self.inputs() + logger.info(f"Dispatching action {self.workflow_file} on {self.owner}/{self.repo} ref={ref}") + self._dispatch(ref, inputs) + + deadline = time.time() + self.timeout_seconds + run = None + while time.time() < deadline: + run = self._latest_run_for_ref(ref) + if run is not None: + break + logger.info(f"Waiting for workflow run to appear...") + time.sleep(self.poll_interval_seconds) + + if run is None: + raise BaseException(f"No workflow run appeared within {self.timeout_seconds}s for ref={ref}") + + run_id = run["id"] + logger.info(f"Watching workflow run {run_id}") + + while time.time() < deadline: + run = self._get_run(run_id) + status = run.get("status") + conclusion = run.get("conclusion") + if status == "completed": + logger.info(f"Workflow run {run_id} completed: {conclusion}") + if conclusion != "success": + raise BaseException( + f"Workflow run {run_id} finished with conclusion={conclusion}: {run.get('html_url')}" + ) + return GitHubActionTriggerResult( + run_id=run_id, + conclusion=conclusion, + image_tag=run.get("outputs", {}).get("image_tag") if isinstance(run.get("outputs"), dict) else None, + ) + time.sleep(self.poll_interval_seconds) + + raise BaseException(f"Workflow run {run_id} did not complete within {self.timeout_seconds}s") -- 2.54.0 From d9823d0abcbbb1c943bc1ece82d7c103a314b16d Mon Sep 17 00:00:00 2001 From: hermes Date: Mon, 31 Aug 2026 18:15:47 +0000 Subject: [PATCH 3/4] chore(torrserv_proxy): revert push_branch_template, use auto-{version} Per Alex's feedback: the original push logic in CheckoutMerged that auto-generates a branch named 'auto-{version}' from the merged commit hashes is the convention we keep. Drop the push_branch_template knob and the matching push_branch field on CheckoutAndMergeResult that were introduced in the previous commit, so downstream steps get the standard remote_branch_name back instead. GitHubActionTrigger uses the merge commit_hash directly (commit_hash field on CheckoutAndMergeResult, which is unaffected) for the workflow ref, so we don't need a dedicated push_branch field. --- backend/configs/torrserv_proxy.py | 2 -- backend/steps/git.py | 20 +++----------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/backend/configs/torrserv_proxy.py b/backend/configs/torrserv_proxy.py index d48796a..2563c39 100644 --- a/backend/configs/torrserv_proxy.py +++ b/backend/configs/torrserv_proxy.py @@ -19,8 +19,6 @@ state = SharedStateHolderInMemory(unmerge=unmerge) checkoutMerged = CheckoutMerged(clone, desired_branches=state, - push=True, - push_branch_template="auto-deploy/torrserv_proxy/{commit_sha}", git_user_email="rudolfss13@gmail.com", git_user_name="brencher_bot" ) diff --git a/backend/steps/git.py b/backend/steps/git.py index 11c6df2..8df31d2 100644 --- a/backend/steps/git.py +++ b/backend/steps/git.py @@ -149,7 +149,6 @@ class CheckoutAndMergeResult: remote_branch_name: str | None commit_hash: str version: str - push_branch: str | None = None def _commits_childs(repo: git.Repo) -> Dict[Commit, List[Commit]]: @@ -185,7 +184,6 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]): git_user_email: str, git_user_name: str, push: bool = True, - push_branch_template: str | None = None, **kwargs: Any): super().__init__(**kwargs) self.wd = wd @@ -193,7 +191,6 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]): self.git_user_email = git_user_email self.git_user_name = git_user_name self.push = push - self.push_branch_template = push_branch_template def _find_merge_childs(self, tree: Dict[Commit, List[Commit]], commit: Commit) -> List[Commit]: @@ -310,29 +307,18 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]): remote_branch_name = branch_name if remote_name == 'origin' else ref.name break if self.push and remote_branch_name is None: - if self.push_branch_template: - auto_branch_name = self.push_branch_template.format( - commit_sha=repo.head.commit.hexsha, - commit_sha_short=repo.head.commit.hexsha[:8], - version=version, - ) - else: - auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest() - auto_branch_name = f"auto-{version}" + auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest() + auto_branch_name = f"auto-{version}" logger.info(f"Pushing {repo.head.commit.hexsha} -> {auto_branch_name}") repo.git.push('-f', 'origin', f"HEAD:refs/heads/{auto_branch_name}") remote_branch_name = auto_branch_name - push_branch = auto_branch_name - else: - push_branch = None return CheckoutAndMergeResult( wd=repo_path, remote_branch_name=remote_branch_name, commit_hash=repo.head.commit.hexsha, - version=version, - push_branch=push_branch, + version=version ) -- 2.54.0 From 308362b807e5e4615fe5f0b5de6abf11f68ae5a8 Mon Sep 17 00:00:00 2001 From: hermes Date: Mon, 31 Aug 2026 18:19:14 +0000 Subject: [PATCH 4/4] Revert "feat(actions): add brencher reusable GitHub Action" This reverts commit 71a9e1b06bab56ff3018488a0d0a15f0b251952a. --- .github/actions/brencher/README.md | 50 ------------------ .github/actions/brencher/action.yml | 81 ----------------------------- 2 files changed, 131 deletions(-) delete mode 100644 .github/actions/brencher/README.md delete mode 100644 .github/actions/brencher/action.yml diff --git a/.github/actions/brencher/README.md b/.github/actions/brencher/README.md deleted file mode 100644 index c65e0d2..0000000 --- a/.github/actions/brencher/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# brencher action - -Reusable GitHub Action that builds a Docker image, pushes it to a registry, and -deploys a Docker Compose stack to a Swarm cluster. - -## Usage - -```yaml -- uses: admin/brencher/.github/actions/brencher@main - with: - registry: registry.example.com - image_name: admin/my-stack - stack_name: my_stack - compose_path: docker-compose.yml - deploy_branch: main - registry_username: ${{ secrets.REGISTRY_USERNAME }} - registry_password: ${{ secrets.REGISTRY_PASSWORD }} - swarm_manager_host: ${{ secrets.SWARM_MANAGER_HOST }} - swarm_ssh_user: ${{ secrets.SWARM_SSH_USER }} - swarm_ssh_key: ${{ secrets.SWARM_SSH_KEY }} -``` - -## Inputs - -| Input | Required | Default | Description | -|-------|----------|---------|-------------| -| `registry` | yes | – | Docker registry hostname | -| `image_name` | yes | – | Image name (e.g. `admin/reverseproxy`) | -| `stack_name` | yes | – | Docker stack name for `docker stack deploy` | -| `compose_path` | no | `docker-compose.yml` | Path to compose file relative to repo root | -| `deploy_branch` | no | `main` | Branch containing the merged-deploy commit on the swarm manager | -| `registry_username` | yes | – | Registry username | -| `registry_password` | yes | – | Registry password | -| `swarm_manager_host` | yes | – | Swarm manager SSH host | -| `swarm_ssh_user` | yes | – | Swarm manager SSH user | -| `swarm_ssh_key` | yes | – | Swarm manager SSH private key | - -## How it works - -1. Resolves the image tag from the current commit SHA: `auto-`. -2. Logs in to the registry. -3. Builds the image with BuildKit, pushes it to the registry with the - `auto-` and `latest` tags, using registry-based cache. -4. SSHes to the swarm manager, fetches the deploy branch, then runs - `docker stack deploy --prune --resolve-image-always` against the compose - file in the repo. - -The deploy branch is fetched and reset to its tip on the swarm manager, so the -compose file the manager sees is always the latest version from the deploy -branch. diff --git a/.github/actions/brencher/action.yml b/.github/actions/brencher/action.yml deleted file mode 100644 index 9149521..0000000 --- a/.github/actions/brencher/action.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: brencher -description: Build, push, and deploy a Docker Compose stack from a watched repo -inputs: - registry: - description: Docker registry hostname - required: true - image_name: - description: Image name (e.g. admin/reverseproxy) - required: true - stack_name: - description: Docker stack name for `docker stack deploy` - required: true - compose_path: - description: Path to docker-compose.yml relative to repo root - required: false - default: docker-compose.yml - deploy_branch: - description: Branch containing the merged-deploy commit - required: false - default: main - registry_username: - description: Registry username - required: true - registry_password: - description: Registry password - required: true - swarm_manager_host: - description: Swarm manager SSH host - required: true - swarm_ssh_user: - description: Swarm manager SSH user - required: true - swarm_ssh_key: - description: Swarm manager SSH private key - required: true - -runs: - using: composite - steps: - - name: Set IMAGE_TAG - id: tag - shell: bash - run: | - if [ -n "${{ github.event.pull_request.head.sha }}" ]; then - echo "value=auto-${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT" - else - echo "value=auto-${{ github.sha }}" >> "$GITHUB_OUTPUT" - fi - - - name: Login to registry - shell: bash - run: | - echo "${{ inputs.registry_password }}" | docker login "${{ inputs.registry }}" -u "${{ inputs.registry_username }}" --password-stdin - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: | - ${{ inputs.registry }}/${{ inputs.image_name }}:${{ steps.tag.outputs.value }} - ${{ inputs.registry }}/${{ inputs.image_name }}:latest - cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.image_name }}:buildcache - cache-to: type=registry,ref=${{ inputs.registry }}/${{ inputs.image_name }}:buildcache,mode=max - - - name: Deploy to swarm - uses: appleboy/drone-ssh-action@v1 - with: - host: ${{ inputs.swarm_manager_host }} - username: ${{ inputs.swarm_ssh_user }} - key: ${{ inputs.swarm_ssh_key }} - script: | - set -e - export IMAGE_TAG=${{ steps.tag.outputs.value }} - cd /opt/brencher-stacks/${{ inputs.stack_name }} - git fetch origin ${{ inputs.deploy_branch }} - git reset --hard origin/${{ inputs.deploy_branch }} - docker stack deploy --prune --resolve-image-always -c ${{ inputs.compose_path }} ${{ inputs.stack_name }} -- 2.54.0