From b84165f708620d624960623d530d3e187e59b2cf Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 00:12:04 -0700
Subject: [PATCH 01/48] Add Standalone Docker Compose
---
.github/workflows/test.yaml | 28 ++++++++++++++--
README.md | 64 ++++++++++++++++++++++++++++++-------
action.yaml | 26 +++++++++------
src/main.sh | 43 ++++++++++++++++---------
4 files changed, 122 insertions(+), 39 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 73ca91c..2569814 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -18,15 +18,16 @@ on:
env:
PRIVATE_IMAGE: ${{ vars.PRIVATE_IMAGE || 'smashedr/alpine-private:latest' }}
+concurrency:
+ group: ${{ github.workflow }}
+ cancel-in-progress: true
+
jobs:
test:
name: "Test"
if: ${{ !contains(github.event.head_commit.message, '#notest') }}
runs-on: ubuntu-latest
timeout-minutes: 5
- concurrency:
- group: ${{ github.workflow }}
- cancel-in-progress: true
steps:
- name: "Checkout"
@@ -82,6 +83,27 @@ jobs:
registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
summary: false
+ - name: "3: Write YAML"
+ if: ${{ !cancelled() }}
+ uses: teunmooij/yaml@v1
+ with:
+ to-file: "docker-compose.yaml"
+ data: |
+ {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
+
+ - name: "3: Test Compose"
+ if: ${{ !cancelled() }}
+ uses: ./
+ with:
+ name: test_stack-deploy
+ file: docker-compose.yaml
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ pass: ${{ secrets.DOCKER_PASS }}
+ #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ compose: true
+
- name: "Schedule Failure Notification"
if: ${{ failure() && github.event_name == 'schedule' }}
uses: sarisia/actions-status-discord@v1
diff --git a/README.md b/README.md
index 838de11..9959eb8 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
[](https://github.com/cssnr/stack-deploy-action/tags)
[](https://github.com/cssnr/stack-deploy-action/tags)
[](https://github.com/cssnr/stack-deploy-action/releases/latest)
-[](https://github.com/cssnr/stack-deploy-action/actions/workflows/release.yaml)
-[](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml)
-[](https://github.com/cssnr/stack-deploy-action/actions/workflows/lint.yaml)
+[](https://github.com/cssnr/stack-deploy-action/actions/workflows/release.yaml)
+[](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml)
+[](https://github.com/cssnr/stack-deploy-action/actions/workflows/lint.yaml)
[](https://github.com/cssnr/stack-deploy-action/graphs/commit-activity)
[](https://codeberg.org/cssnr/stack-deploy-action)
[](https://github.com/cssnr/stack-deploy-action)
@@ -21,6 +21,8 @@
- [Support](#Support)
- [Contributing](#Contributing)
+> **Now works with vanilla Docker hosts using Compose. No Swarm Required!**
+
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
You can also optionally authenticate against a private registry using a username and password.
@@ -36,10 +38,12 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
## Inputs
-| input | required | default | description |
-| ------------- | :----------: | --------------------- | ----------------------------------------- |
-| name | **Yes** | - | Docker Stack Name |
-| file | - | `docker-compose.yaml` | Docker Compose File |
+| Input | Required | Default | Description |
+| :------------ | :----------: | :-------------------- | :---------------------------------------- |
+| name | _for swarm_ | - | Docker Stack Name for Swarm |
+| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
+| compose | - | `false` | Uses Compose instead of Swarm \* |
+| compose_args | - | - | Additional Arguments for Compose \* |
| host | **Yes** | - | Remote Docker Hostname or IP \* |
| port | - | `22` | Remote Docker Port |
| user | **Yes** | - | Remote Docker Username |
@@ -48,7 +52,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| env_file | - | - | Docker Environment File \* |
| detach | - | `true` | Detach Flag, `false` to disable \* |
| prune | - | `false` | Prune Flag, `true` to enable |
-| resolve_image | - | `always` | Options [`always`, `changed`, `never`] \* |
+| resolve_image | - | `always` | Resolve [`always`, `changed`, `never`] \* |
| registry_auth | - | - | Enable Registry Authentication \* |
| registry_host | - | - | Registry Authentication Host \* |
| registry_user | - | - | Registry Authentication Username \* |
@@ -58,6 +62,13 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
_For additional details on inputs, see the stack deploy
[documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/)._
+**compose** - Set this to `true` to use `compose up` instead of `stack deploy` for standalone Docker hosts.
+
+**compose_args** - Arguments to pass to the `compose up` command. Only used for `compose: true` deployments.
+Detach `-d` is always passed. With no args the default is `--remove-orphans --force-recreate`.
+Use an empty string to override. For more details, see the compose up
+[docs](https://docs.docker.com/reference/cli/docker/compose/up/).
+
**host** - The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
@@ -149,7 +160,6 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
```
-
With SSH key, --prune, --detach=false and --resolve-image=changed
```yaml
@@ -168,7 +178,6 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
```
-
With All Inputs
```yaml
@@ -194,7 +203,39 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
```
+Standalone Compose with Defaults
+
+```yaml
+- name: 'Stack Deploy'
+ uses: cssnr/stack-deploy-action@v1
+ with:
+ file: 'docker-compose.yaml'
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ compose: true
+```
+
+
+Standalone Compose with Custom Arguments
+```yaml
+- name: 'Stack Deploy'
+ uses: cssnr/stack-deploy-action@v1
+ with:
+ file: 'docker-compose.yaml'
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ compose: true
+ compose_args: --remove-orphans --force-recreate
+```
+
+Note: these are the default arguments. To remove them pass an empty string.
+
+
Simple Workflow Example
```yaml
@@ -225,7 +266,6 @@ jobs:
```
-
Full Workflow Example
```yaml
@@ -333,7 +373,7 @@ https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags) are maintained.
| Tag | Example | Target | Bugs | Feat. | Description |
-| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | :--: | :---: | --------------------------------------------------------- |
+| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :--: | :---: | :-------------------------------------------------------- |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | Includes new features but is always backwards compatible. |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ❌ | Only receives bug fixes. This is the most stable tag. |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | Not a rolling tag. **Not** recommended. |
diff --git a/action.yaml b/action.yaml
index 4f770fe..5b382be 100644
--- a/action.yaml
+++ b/action.yaml
@@ -1,18 +1,33 @@
name: "Docker Stack Deploy"
-description: "Deploy a Docker Stack to a Remote Host over SSH w/ Optional Registry Authentication"
+description: "Deploy a Docker Compose or Stack to a Remote Host over SSH w/ Optional Registry Authentication"
author: "Shane"
branding:
icon: "layers"
color: "green"
inputs:
+ name:
+ description: "Docker Stack Name"
+ required: false
+ file:
+ description: "Docker Compose File"
+ required: false
+ default: "docker-compose.yaml"
+ compose:
+ description: "Use Compose"
+ required: false
+ default: "false"
+ compose_args:
+ description: "Compose Arguments"
+ required: false
+ default: "--remove-orphans --force-recreate"
host:
description: "Docker Host"
required: true
port:
description: "Docker Port"
- default: "22"
required: false
+ default: "22"
user:
description: "Docker User"
required: true
@@ -22,13 +37,6 @@ inputs:
ssh_key:
description: "SSH Key File"
required: false
- name:
- description: "Docker Stack Name"
- required: true
- file:
- description: "Docker Compose File"
- required: false
- default: "docker-compose.yaml"
env_file:
description: "Environment File"
required: false
diff --git a/src/main.sh b/src/main.sh
index 38d5c58..2439318 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -11,8 +11,8 @@ function cleanup_trap() {
"sed -i '/docker-stack-deploy-action/d' ~/.ssh/authorized_keys"
fi
if [[ "${_ST}" != "0" ]]; then
- echo -e "⛔ \u001b[31;1mFailed to deploy stack ${INPUT_NAME}"
- echo "::error::Failed to deploy stack ${INPUT_NAME}. See logs for details..."
+ echo -e "⛔ \u001b[31;1mFailed to deploy stack!"
+ echo "::error::Failed to deploy stack. See logs for details..."
else
echo -e "✅ \u001b[32;1mFinished Success"
fi
@@ -83,30 +83,43 @@ if [[ -n "${INPUT_REGISTRY_AUTH}" ]];then
echo "::debug::Adding: --with-registry-auth"
EXTRA_ARGS+=("--with-registry-auth")
fi
-if [[ "${INPUT_DETACH}" != "true" ]];then
- echo "::debug::Adding: --detach=false"
- EXTRA_ARGS+=("--detach=false")
-fi
if [[ "${INPUT_PRUNE}" != "false" ]];then
echo "::debug::Adding: --prune"
EXTRA_ARGS+=("--prune")
fi
-if [[ "${INPUT_RESOLVE_IMAGE}" != "always" ]];then
- if [[ "${INPUT_RESOLVE_IMAGE}" == "changed" || "${INPUT_RESOLVE_IMAGE}" == "never" ]];then
- echo "::debug::Adding: --resolve-image=${INPUT_RESOLVE_IMAGE}"
- EXTRA_ARGS+=("--resolve-image=${INPUT_RESOLVE_IMAGE}")
- else
- echo "::error::Input resolve_image must be one of: always, changed, never"
+
+if [[ "${INPUT_COMPOSE}" != "false" ]];then
+ echo "::debug::Adding: ${INPUT_COMPOSE_ARGS}"
+ read -r -a args <<< "${INPUT_COMPOSE_ARGS}"
+ EXTRA_ARGS+=("${args[@]}")
+else
+ if [[ "${INPUT_DETACH}" != "true" ]];then
+ echo "::debug::Adding: --detach=false"
+ EXTRA_ARGS+=("--detach=false")
+ fi
+ if [[ "${INPUT_RESOLVE_IMAGE}" != "always" ]];then
+ if [[ "${INPUT_RESOLVE_IMAGE}" == "changed" || "${INPUT_RESOLVE_IMAGE}" == "never" ]];then
+ echo "::debug::Adding: --resolve-image=${INPUT_RESOLVE_IMAGE}"
+ EXTRA_ARGS+=("--resolve-image=${INPUT_RESOLVE_IMAGE}")
+ else
+ echo "::error::Input resolve_image must be one of: always, changed, never"
+ fi
fi
fi
-echo -e "::group::Deploying Stack: \u001b[36;1m${INPUT_NAME}"
-COMMAND=("docker" "stack" "deploy" "${EXTRA_ARGS[@]}" "-c" "${INPUT_FILE}" "${INPUT_NAME}")
+if [[ "${INPUT_COMPOSE}" != "false" ]];then
+ _type="Docker Compose"
+ COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
+else
+ _type="Docker Stack \u001b[36;1m${INPUT_NAME}"
+ COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
+fi
+
+echo -e "::group::Deploying ${_type}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
STACK_RESULTS=$("${COMMAND[@]}" | tee >(cat >&5))
-
echo "::endgroup::"
if [[ "${INPUT_SUMMARY}" == "true" ]];then
From 0ece4053d95a57f3a2ebc9ca6d86605ffe2dbe70 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 00:33:40 -0700
Subject: [PATCH 02/48] use stack name for compose project
---
.github/workflows/test.yaml | 84 ++++++++++++++++++-------------------
README.md | 13 +++---
action.yaml | 2 +-
src/main.sh | 10 ++---
4 files changed, 55 insertions(+), 54 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 2569814..5e3b6ff 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -37,51 +37,51 @@ jobs:
# run: |
# cat "${GITHUB_EVENT_PATH}"
- - name: "1: Write YAML"
- if: ${{ !cancelled() }}
- uses: teunmooij/yaml@v1
- with:
- to-file: "docker-compose.yaml"
- data: |
- {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
+ #- name: "1: Write YAML"
+ # if: ${{ !cancelled() }}
+ # uses: teunmooij/yaml@v1
+ # with:
+ # to-file: "docker-compose.yaml"
+ # data: |
+ # {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
- - name: "1: Test Password"
- if: ${{ !cancelled() }}
- uses: ./
- with:
- name: test_stack-deploy
- file: docker-compose.yaml
- host: ${{ secrets.DOCKER_HOST }}
- port: ${{ secrets.DOCKER_PORT }}
- user: ${{ secrets.DOCKER_USER }}
- pass: ${{ secrets.DOCKER_PASS }}
- #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- detach: false
- resolve_image: "changed"
+ #- name: "1: Test Password"
+ # if: ${{ !cancelled() }}
+ # uses: ./
+ # with:
+ # name: test_stack-deploy
+ # file: docker-compose.yaml
+ # host: ${{ secrets.DOCKER_HOST }}
+ # port: ${{ secrets.DOCKER_PORT }}
+ # user: ${{ secrets.DOCKER_USER }}
+ # pass: ${{ secrets.DOCKER_PASS }}
+ # #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ # detach: false
+ # resolve_image: "changed"
- - name: "2: Write YAML"
- if: ${{ !cancelled() && !github.event.act }}
- uses: teunmooij/yaml@v1
- with:
- to-file: "docker-compose.yaml"
- data: |
- {"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
+ #- name: "2: Write YAML"
+ # if: ${{ !cancelled() && !github.event.act }}
+ # uses: teunmooij/yaml@v1
+ # with:
+ # to-file: "docker-compose.yaml"
+ # data: |
+ # {"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
- - name: "2: Test SSH and Auth"
- if: ${{ !cancelled() && !github.event.act }}
- uses: ./
- with:
- name: test_stack-deploy
- file: docker-compose.yaml
- host: ${{ secrets.DOCKER_HOST }}
- port: ${{ secrets.DOCKER_PORT }}
- user: ${{ secrets.DOCKER_USER }}
- #pass: ${{ secrets.DOCKER_PASS }}
- ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- prune: true
- registry_user: ${{ vars.DOCKER_HUB_USER }}
- registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
- summary: false
+ #- name: "2: Test SSH and Auth"
+ # if: ${{ !cancelled() && !github.event.act }}
+ # uses: ./
+ # with:
+ # name: test_stack-deploy
+ # file: docker-compose.yaml
+ # host: ${{ secrets.DOCKER_HOST }}
+ # port: ${{ secrets.DOCKER_PORT }}
+ # user: ${{ secrets.DOCKER_USER }}
+ # #pass: ${{ secrets.DOCKER_PASS }}
+ # ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ # prune: true
+ # registry_user: ${{ vars.DOCKER_HUB_USER }}
+ # registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
+ # summary: false
- name: "3: Write YAML"
if: ${{ !cancelled() }}
diff --git a/README.md b/README.md
index 9959eb8..340583a 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| Input | Required | Default | Description |
| :------------ | :----------: | :-------------------- | :---------------------------------------- |
-| name | _for swarm_ | - | Docker Stack Name for Swarm |
+| name | **Yes** | - | Docker Stack/Project Name \* |
| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
| compose | - | `false` | Uses Compose instead of Swarm \* |
| compose_args | - | - | Additional Arguments for Compose \* |
@@ -59,10 +59,12 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| registry_pass | - | - | Registry Authentication Password \* |
| summary | - | `true` | Add Job Summary \* |
-_For additional details on inputs, see the stack deploy
-[documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/)._
+_Swarm hosts, see the stack deploy [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/) for more details._
+_Compose hosts, see the compose up [documentation](https://docs.docker.com/reference/cli/docker/compose/up/) for more details._
-**compose** - Set this to `true` to use `compose up` instead of `stack deploy` for standalone Docker hosts.
+**name** - For Swarm this is the stack name and for Compose the project name.
+
+**compose** - Set this to `true` to use `compose up` instead of `stack deploy` for non-swarm Docker hosts.
**compose_args** - Arguments to pass to the `compose up` command. Only used for `compose: true` deployments.
Detach `-d` is always passed. With no args the default is `--remove-orphans --force-recreate`.
@@ -91,8 +93,7 @@ This will generate extra output in the logs and is useful for debugging deployme
**summary** - Write a Summary for the job. To disable this set to `false`.
-To view a workflow run, click on a recent
-[Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
+To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
👀 View Example Job Summary
diff --git a/action.yaml b/action.yaml
index 5b382be..7be6d6f 100644
--- a/action.yaml
+++ b/action.yaml
@@ -8,7 +8,7 @@ branding:
inputs:
name:
description: "Docker Stack Name"
- required: false
+ required: true
file:
description: "Docker Compose File"
required: false
diff --git a/src/main.sh b/src/main.sh
index 2439318..c50a311 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -11,8 +11,8 @@ function cleanup_trap() {
"sed -i '/docker-stack-deploy-action/d' ~/.ssh/authorized_keys"
fi
if [[ "${_ST}" != "0" ]]; then
- echo -e "⛔ \u001b[31;1mFailed to deploy stack!"
- echo "::error::Failed to deploy stack. See logs for details..."
+ echo -e "⛔ \u001b[31;1mFailed to deploy stack ${INPUT_NAME}"
+ echo "::error::Failed to deploy stack ${INPUT_NAME}. See logs for details..."
else
echo -e "✅ \u001b[32;1mFinished Success"
fi
@@ -109,13 +109,13 @@ fi
if [[ "${INPUT_COMPOSE}" != "false" ]];then
_type="Docker Compose"
- COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
+ COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
else
- _type="Docker Stack \u001b[36;1m${INPUT_NAME}"
+ _type="Docker Stack"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
fi
-echo -e "::group::Deploying ${_type}"
+echo -e "::group::Deploying ${_type} \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
From badf35592c24e8de930e30fa9a03a3201e5dee86 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 00:50:23 -0700
Subject: [PATCH 03/48] update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 340583a..ee12f07 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,7 @@
- [Support](#Support)
- [Contributing](#Contributing)
+> [!TIP]
> **Now works with vanilla Docker hosts using Compose. No Swarm Required!**
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
From 777b7f100ab4950ac02ab2e73dd9aa15653bc929 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 00:55:10 -0700
Subject: [PATCH 04/48] update README.md
---
README.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/README.md b/README.md
index ee12f07..ad79eae 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,20 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
_Swarm hosts, see the stack deploy [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/) for more details._
_Compose hosts, see the compose up [documentation](https://docs.docker.com/reference/cli/docker/compose/up/) for more details._
+🖱️ Click Here to see how the script generates the command
+
+```shell
+if [[ "${INPUT_COMPOSE}" != "false" ]];then
+ _type="Docker Compose"
+ COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
+else
+ _type="Docker Stack"
+ COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
+fi
+```
+
+
+
**name** - For Swarm this is the stack name and for Compose the project name.
**compose** - Set this to `true` to use `compose up` instead of `stack deploy` for non-swarm Docker hosts.
From 8efd0c76f24e19a904fbc3324bfe360a8943d056 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 01:05:06 -0700
Subject: [PATCH 05/48] update README.md
---
README.md | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index ad79eae..5eee7ca 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
_Swarm hosts, see the stack deploy [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/) for more details._
_Compose hosts, see the compose up [documentation](https://docs.docker.com/reference/cli/docker/compose/up/) for more details._
-🖱️ Click Here to see how the script generates the command
+📟 Click Here to see how command is generated
```shell
if [[ "${INPUT_COMPOSE}" != "false" ]];then
@@ -219,12 +219,13 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
```
-Standalone Compose with Defaults
+Compose with Defaults
```yaml
-- name: 'Stack Deploy'
+- name: 'Compose Deploy'
uses: cssnr/stack-deploy-action@v1
with:
+ name: 'stack-name'
file: 'docker-compose.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
@@ -234,12 +235,13 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
```
-Standalone Compose with Custom Arguments
+Compose with Custom Arguments
```yaml
-- name: 'Stack Deploy'
+- name: 'Compose Deploy'
uses: cssnr/stack-deploy-action@v1
with:
+ name: 'stack-name'
file: 'docker-compose.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
From a074fedb77fd239527c0c902c9cb8c6d0120d57e Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 01:10:12 -0700
Subject: [PATCH 06/48] update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5eee7ca..d38b636 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@
- [Contributing](#Contributing)
> [!TIP]
-> **Now works with vanilla Docker hosts using Compose. No Swarm Required!**
+> 🐳 Now works with vanilla Docker hosts using Compose. **No Swarm Required!**
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
You can also optionally authenticate against a private registry using a username and password.
From b2b7785bcc21a0dce322f2e9a722278464a4b787 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 13:08:47 -0700
Subject: [PATCH 07/48] update README.md
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index d38b636..ed3163d 100644
--- a/README.md
+++ b/README.md
@@ -390,11 +390,11 @@ https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags) are maintained.
-| Tag | Example | Target | Bugs | Feat. | Description |
-| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :--: | :---: | :-------------------------------------------------------- |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | Includes new features but is always backwards compatible. |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ❌ | Only receives bug fixes. This is the most stable tag. |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | Not a rolling tag. **Not** recommended. |
+| Tag | Example | Target | Rolling | Bugs | Feat. |
+| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
You can view the release notes for each version on the [releases](https://github.com/cssnr/stack-deploy-action/releases) page.
From 95b5e94fdea906e9f3027fb99045227fe9dc9c56 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 13:14:37 -0700
Subject: [PATCH 08/48] update README.md
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index ed3163d..c77815b 100644
--- a/README.md
+++ b/README.md
@@ -390,11 +390,11 @@ https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags) are maintained.
-| Tag | Example | Target | Rolling | Bugs | Feat. |
-| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
+| Tag | Example | Target | Rolling | Bugs | Feat. |
+| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
You can view the release notes for each version on the [releases](https://github.com/cssnr/stack-deploy-action/releases) page.
From 436dbc269f2d6cbfece65bc9bcb8dc216925d517 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 13:15:59 -0700
Subject: [PATCH 09/48] update README.md
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index c77815b..f186bdb 100644
--- a/README.md
+++ b/README.md
@@ -390,11 +390,11 @@ https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags) are maintained.
-| Tag | Example | Target | Rolling | Bugs | Feat. |
-| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
+| Version Tag | Example | Target | Rolling | Bugs | Feat. |
+| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
You can view the release notes for each version on the [releases](https://github.com/cssnr/stack-deploy-action/releases) page.
From afacbd74de96d20dd3bf14cc3dd05f265296964e Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 13:20:17 -0700
Subject: [PATCH 10/48] update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f186bdb..314e205 100644
--- a/README.md
+++ b/README.md
@@ -390,7 +390,7 @@ https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags) are maintained.
-| Version Tag | Example | Target | Rolling | Bugs | Feat. |
+| Version Tag | Example | Target | Rolling | Bugs | Feat. |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
From e707f2b218af9bc550a05188f42d05160e341fdb Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 13:29:54 -0700
Subject: [PATCH 11/48] update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 314e205..0b4a348 100644
--- a/README.md
+++ b/README.md
@@ -392,7 +392,7 @@ The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags)
| Version Tag | Example | Target | Rolling | Bugs | Feat. |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
From a6486455965d9a01e300e23abf773e7d1fe27881 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 13:50:28 -0700
Subject: [PATCH 12/48] update README.md
---
README.md | 64 ++++++++++++++++++++++++++---------------------------
src/main.sh | 4 ++--
2 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/README.md b/README.md
index 0b4a348..e50ffd4 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@
- [Contributing](#Contributing)
> [!TIP]
-> 🐳 Now works with vanilla Docker hosts using Compose. **No Swarm Required!**
+> 🐳 Now works with vanilla Docker hosts using **Compose. No Swarm Required!**
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
You can also optionally authenticate against a private registry using a username and password.
@@ -39,52 +39,51 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
## Inputs
-| Input | Required | Default | Description |
-| :------------ | :----------: | :-------------------- | :---------------------------------------- |
-| name | **Yes** | - | Docker Stack/Project Name \* |
-| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
-| compose | - | `false` | Uses Compose instead of Swarm \* |
-| compose_args | - | - | Additional Arguments for Compose \* |
-| host | **Yes** | - | Remote Docker Hostname or IP \* |
-| port | - | `22` | Remote Docker Port |
-| user | **Yes** | - | Remote Docker Username |
-| pass | or `ssh_key` | - | Remote Docker Password \* |
-| ssh_key | or `pass` | - | Remote SSH Key File \* |
-| env_file | - | - | Docker Environment File \* |
-| detach | - | `true` | Detach Flag, `false` to disable \* |
-| prune | - | `false` | Prune Flag, `true` to enable |
-| resolve_image | - | `always` | Resolve [`always`, `changed`, `never`] \* |
-| registry_auth | - | - | Enable Registry Authentication \* |
-| registry_host | - | - | Registry Authentication Host \* |
-| registry_user | - | - | Registry Authentication Username \* |
-| registry_pass | - | - | Registry Authentication Password \* |
-| summary | - | `true` | Add Job Summary \* |
+| Input | Required | Default | Description |
+| :------------- | :----------: | :---------------------------------- | :---------------------------------------- |
+| name | **Yes** | - | Docker Stack/Project Name \* |
+| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
+| _compose_ | - | `false` | Use **Compose** instead of Swarm \* |
+| _compose_args_ | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
+| host | **Yes** | - | Remote Docker Hostname or IP \* |
+| port | - | `22` | Remote Docker Port |
+| user | **Yes** | - | Remote Docker Username |
+| pass | or `ssh_key` | - | Remote Docker Password \* |
+| ssh_key | or `pass` | - | Remote SSH Key File \* |
+| env_file | - | - | Docker Environment File \* |
+| detach | - | `true` | Detach Flag, `false` to disable \* |
+| prune | - | `false` | Prune Flag, `true` to enable |
+| resolve_image | - | `always` | Resolve [`always`, `changed`, `never`] \* |
+| registry_auth | - | - | Enable Registry Authentication \* |
+| registry_host | - | - | Registry Authentication Host \* |
+| registry_user | - | - | Registry Authentication Username \* |
+| registry_pass | - | - | Registry Authentication Password \* |
+| summary | - | `true` | Add Job Summary \* |
_Swarm hosts, see the stack deploy [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/) for more details._
_Compose hosts, see the compose up [documentation](https://docs.docker.com/reference/cli/docker/compose/up/) for more details._
-📟 Click Here to see how command is generated
+📟 Click Here to see how the deployment command is generated
```shell
if [[ "${INPUT_COMPOSE}" != "false" ]];then
_type="Docker Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
else
- _type="Docker Stack"
+ _type="Docker Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
fi
```
-**name** - For Swarm this is the stack name and for Compose the project name.
+**name** - Stack name for Swarm and project name for Compose.
**compose** - Set this to `true` to use `compose up` instead of `stack deploy` for non-swarm Docker hosts.
**compose_args** - Arguments to pass to the `compose up` command. Only used for `compose: true` deployments.
-Detach `-d` is always passed. With no args the default is `--remove-orphans --force-recreate`.
-Use an empty string to override. For more details, see the compose up
-[docs](https://docs.docker.com/reference/cli/docker/compose/up/).
+The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
+Use an empty string to override. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
**host** - The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
@@ -97,6 +96,7 @@ If you need compose file templating this can also be done in a previous step.
**detach** - Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
+This is automatically set to `false` if you set `compose: true`.
**resolve_image** - When the default `always` is used, this argument is omitted.
@@ -390,11 +390,11 @@ https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags) are maintained.
-| Version Tag | Example | Target | Rolling | Bugs | Feat. |
-| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------- | :-----: | :--: | :---: |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN` | `vN.x.x` | ✅ | ✅ | ✅ |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N` | `vN.N.x` | ✅ | ✅ | ❌ |
-| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | `vN.N.N` | `vN.N.N` | ❌ | ❌ | ❌ |
+| Version Tag | Rolling | Bugs | Feat. | Target | Example |
+| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: | :--: | :---: | :------- | :------- |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | ✅ | ✅ | ✅ | `vN.x.x` | `vN` |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | ✅ | ✅ | ❌ | `vN.N.x` | `vN.N` |
+| [](https://github.com/cssnr/stack-deploy-action/releases/latest) | ❌ | ❌ | ❌ | `vN.N.N` | `vN.N.N` |
You can view the release notes for each version on the [releases](https://github.com/cssnr/stack-deploy-action/releases) page.
diff --git a/src/main.sh b/src/main.sh
index c50a311..6c2828f 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -111,11 +111,11 @@ if [[ "${INPUT_COMPOSE}" != "false" ]];then
_type="Docker Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
else
- _type="Docker Stack"
+ _type="Docker Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
fi
-echo -e "::group::Deploying ${_type} \u001b[36;1m${INPUT_NAME}"
+echo -e "::group::Deploying ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
From f579652b62da7f75870d42a7fdfe7718abcf763d Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 14:25:22 -0700
Subject: [PATCH 13/48] Fix Compose Output
---
src/main.sh | 2 +-
src/summary.sh | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main.sh b/src/main.sh
index 6c2828f..d61b311 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -119,7 +119,7 @@ echo -e "::group::Deploying ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
-STACK_RESULTS=$("${COMMAND[@]}" | tee >(cat >&5))
+STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5))
echo "::endgroup::"
if [[ "${INPUT_SUMMARY}" == "true" ]];then
diff --git a/src/summary.sh b/src/summary.sh
index 07b017e..bb1675d 100644
--- a/src/summary.sh
+++ b/src/summary.sh
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
+# shellcheck disable=SC2154
cat << EOM
## Stack Deploy Action
-🎉 Stack \`${INPUT_NAME}\` Successfully Deployed.
+🎉 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed.
\`\`\`text
${COMMAND[*]}
From 565837c1b1071be88f58edd9fa91ee7404c9cdcb Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 14:51:25 -0700
Subject: [PATCH 14/48] Fix Auth
---
.github/workflows/test.yaml | 33 ++++++++++++++++++++++++++++++---
README.md | 4 ++--
src/main.sh | 14 +++++++-------
src/summary.sh | 4 ++--
4 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 5e3b6ff..0a36bfd 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -83,15 +83,40 @@ jobs:
# registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
# summary: false
- - name: "3: Write YAML"
+ #- name: "3: Write YAML"
+ # if: ${{ !cancelled() && !github.event.act }}
+ # uses: teunmooij/yaml@v1
+ # with:
+ # to-file: "docker-compose.yaml"
+ # data: |
+ # {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
+
+ #- name: "3: Test Compose"
+ # if: ${{ !cancelled() && !github.event.act }}
+ # uses: ./
+ # with:
+ # name: test_stack-deploy
+ # file: docker-compose.yaml
+ # host: ${{ secrets.DOCKER_HOST }}
+ # port: ${{ secrets.DOCKER_PORT }}
+ # user: ${{ secrets.DOCKER_USER }}
+ # pass: ${{ secrets.DOCKER_PASS }}
+ # #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ # compose: true
+
+ - name: "4: Write YAML"
if: ${{ !cancelled() }}
uses: teunmooij/yaml@v1
with:
to-file: "docker-compose.yaml"
data: |
- {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
+ {"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
+
+ - name: "4: Debug Compose"
+ run: |
+ cat "docker-compose.yaml"
- - name: "3: Test Compose"
+ - name: "4: Test Compose Auth"
if: ${{ !cancelled() }}
uses: ./
with:
@@ -103,6 +128,8 @@ jobs:
pass: ${{ secrets.DOCKER_PASS }}
#ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
compose: true
+ registry_user: ${{ vars.DOCKER_HUB_USER }}
+ registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
- name: "Schedule Failure Notification"
if: ${{ failure() && github.event_name == 'schedule' }}
diff --git a/README.md b/README.md
index e50ffd4..213851c 100644
--- a/README.md
+++ b/README.md
@@ -67,10 +67,10 @@ _Compose hosts, see the compose up [documentation](https://docs.docker.com/refer
```shell
if [[ "${INPUT_COMPOSE}" != "false" ]];then
- _type="Docker Compose"
+ _type="Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
else
- _type="Docker Swarm"
+ _type="Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
fi
```
diff --git a/src/main.sh b/src/main.sh
index d61b311..16f1cd9 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -79,10 +79,6 @@ if [[ -n "${INPUT_REGISTRY_USER}" && -n "${INPUT_REGISTRY_PASS}" ]];then
fi
EXTRA_ARGS=()
-if [[ -n "${INPUT_REGISTRY_AUTH}" ]];then
- echo "::debug::Adding: --with-registry-auth"
- EXTRA_ARGS+=("--with-registry-auth")
-fi
if [[ "${INPUT_PRUNE}" != "false" ]];then
echo "::debug::Adding: --prune"
EXTRA_ARGS+=("--prune")
@@ -93,6 +89,10 @@ if [[ "${INPUT_COMPOSE}" != "false" ]];then
read -r -a args <<< "${INPUT_COMPOSE_ARGS}"
EXTRA_ARGS+=("${args[@]}")
else
+ if [[ -n "${INPUT_REGISTRY_AUTH}" ]];then
+ echo "::debug::Adding: --with-registry-auth"
+ EXTRA_ARGS+=("--with-registry-auth")
+ fi
if [[ "${INPUT_DETACH}" != "true" ]];then
echo "::debug::Adding: --detach=false"
EXTRA_ARGS+=("--detach=false")
@@ -108,14 +108,14 @@ else
fi
if [[ "${INPUT_COMPOSE}" != "false" ]];then
- _type="Docker Compose"
+ _type="Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
else
- _type="Docker Swarm"
+ _type="Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
fi
-echo -e "::group::Deploying ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
+echo -e "::group::Deploying Docker ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
diff --git a/src/summary.sh b/src/summary.sh
index bb1675d..9ef6af0 100644
--- a/src/summary.sh
+++ b/src/summary.sh
@@ -4,7 +4,7 @@
cat << EOM
## Stack Deploy Action
-🎉 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed.
+🚀 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed.
\`\`\`text
${COMMAND[*]}
@@ -18,7 +18,7 @@ ${STACK_RESULTS}
-[Report an issue or request a feature](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
+[View Documentation, Report Issues or Request Features](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
---
EOM
From a5489172c633f473a762653caac241e1406d5999 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 15:10:32 -0700
Subject: [PATCH 15/48] Updates
---
README.md | 12 +++++++-----
action.yaml | 10 +++++-----
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 213851c..05e48cb 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@
- [Contributing](#Contributing)
> [!TIP]
-> 🐳 Now works with vanilla Docker hosts using **Compose. No Swarm Required!**
+> 💡 Now works with vanilla Docker hosts using **Compose. No Swarm Required!**
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
You can also optionally authenticate against a private registry using a username and password.
@@ -88,19 +88,20 @@ Use an empty string to override. For more details, see the compose up [docs](htt
**host** - The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
-**pass/ssh_key** - You must provide either a `pass` or `ssh_key`.
+**pass/ssh_key** - You must provide either a `pass` or `ssh_key`, but not both.
**env_file** - Variables in this file are exported before running stack deploy.
To use a docker `env_file` specify it in your compose file and make it available in a previous step.
If you need compose file templating this can also be done in a previous step.
+If using `compose: true` you can add the `compose_arg: --env-file stringArray`.
**detach** - Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
This is automatically set to `false` if you set `compose: true`.
-**resolve_image** - When the default `always` is used, this argument is omitted.
+**resolve_image** - When the default `always` is used, this argument is omitted. Swarm only.
-**registry_auth** - Set to `true` to deploy with `--with-registry-auth`.
+**registry_auth** - Set to `true` to deploy with `--with-registry-auth`. Swarm only.
**registry_host** - To run `docker login` on another registry. Example: `ghcr.io`
@@ -251,7 +252,8 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
compose_args: --remove-orphans --force-recreate
```
-Note: these are the default arguments. To remove them pass an empty string.
+Note: these are the default arguments. If you use `compose_args` this will override the default arguments unless they are included.
+You can disable them by passing an empty string.
Simple Workflow Example
diff --git a/action.yaml b/action.yaml
index 7be6d6f..205288a 100644
--- a/action.yaml
+++ b/action.yaml
@@ -22,20 +22,20 @@ inputs:
required: false
default: "--remove-orphans --force-recreate"
host:
- description: "Docker Host"
+ description: "Remote Docker Host"
required: true
port:
- description: "Docker Port"
+ description: "Remote Docker Port"
required: false
default: "22"
user:
- description: "Docker User"
+ description: "Remote Docker User"
required: true
pass:
- description: "Docker Pass"
+ description: "Remote Docker Pass"
required: false
ssh_key:
- description: "SSH Key File"
+ description: "Remote SSH Key File"
required: false
env_file:
description: "Environment File"
From cf31cd3b0245caa9578d8440486abfcb28525aeb Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 15:38:15 -0700
Subject: [PATCH 16/48] Update test.yaml
---
.github/workflows/test.yaml | 127 ++++++++++++++++++------------------
CONTRIBUTING.md | 2 +-
README.md | 4 +-
src/main.sh | 26 +++++++-
4 files changed, 88 insertions(+), 71 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 0a36bfd..aa0905a 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -37,72 +37,73 @@ jobs:
# run: |
# cat "${GITHUB_EVENT_PATH}"
- #- name: "1: Write YAML"
- # if: ${{ !cancelled() }}
- # uses: teunmooij/yaml@v1
- # with:
- # to-file: "docker-compose.yaml"
- # data: |
- # {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
+ - name: "1: Write YAML"
+ if: ${{ !cancelled() }}
+ uses: teunmooij/yaml@v1
+ with:
+ to-file: "docker-compose.yaml"
+ data: |
+ {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
- #- name: "1: Test Password"
- # if: ${{ !cancelled() }}
- # uses: ./
- # with:
- # name: test_stack-deploy
- # file: docker-compose.yaml
- # host: ${{ secrets.DOCKER_HOST }}
- # port: ${{ secrets.DOCKER_PORT }}
- # user: ${{ secrets.DOCKER_USER }}
- # pass: ${{ secrets.DOCKER_PASS }}
- # #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- # detach: false
- # resolve_image: "changed"
+ - name: "1: Test Password"
+ if: ${{ !cancelled() }}
+ uses: ./
+ with:
+ name: test_stack-deploy
+ file: docker-compose.yaml
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ pass: ${{ secrets.DOCKER_PASS }}
+ #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ detach: false
+ resolve_image: "changed"
- #- name: "2: Write YAML"
- # if: ${{ !cancelled() && !github.event.act }}
- # uses: teunmooij/yaml@v1
- # with:
- # to-file: "docker-compose.yaml"
- # data: |
- # {"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
+ - name: "2: Write YAML"
+ if: ${{ !cancelled() && !github.event.act }}
+ uses: teunmooij/yaml@v1
+ with:
+ to-file: "docker-compose.yaml"
+ data: |
+ {"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
- #- name: "2: Test SSH and Auth"
- # if: ${{ !cancelled() && !github.event.act }}
- # uses: ./
- # with:
- # name: test_stack-deploy
- # file: docker-compose.yaml
- # host: ${{ secrets.DOCKER_HOST }}
- # port: ${{ secrets.DOCKER_PORT }}
- # user: ${{ secrets.DOCKER_USER }}
- # #pass: ${{ secrets.DOCKER_PASS }}
- # ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- # prune: true
- # registry_user: ${{ vars.DOCKER_HUB_USER }}
- # registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
- # summary: false
+ - name: "2: Test SSH and Auth"
+ if: ${{ !cancelled() && !github.event.act }}
+ uses: ./
+ with:
+ name: test_stack-deploy
+ file: docker-compose.yaml
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ #pass: ${{ secrets.DOCKER_PASS }}
+ ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ prune: true
+ registry_user: ${{ vars.DOCKER_HUB_USER }}
+ registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
+ summary: false
- #- name: "3: Write YAML"
- # if: ${{ !cancelled() && !github.event.act }}
- # uses: teunmooij/yaml@v1
- # with:
- # to-file: "docker-compose.yaml"
- # data: |
- # {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
+ - name: "3: Write YAML"
+ if: ${{ !cancelled() && !github.event.act }}
+ uses: teunmooij/yaml@v1
+ with:
+ to-file: "docker-compose.yaml"
+ data: |
+ {"version":"3.8","services":{"alpine":{"image":"alpine:latest","command":"tail -f /dev/null"}}}
- #- name: "3: Test Compose"
- # if: ${{ !cancelled() && !github.event.act }}
- # uses: ./
- # with:
- # name: test_stack-deploy
- # file: docker-compose.yaml
- # host: ${{ secrets.DOCKER_HOST }}
- # port: ${{ secrets.DOCKER_PORT }}
- # user: ${{ secrets.DOCKER_USER }}
- # pass: ${{ secrets.DOCKER_PASS }}
- # #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- # compose: true
+ - name: "3: Test Compose"
+ if: ${{ !cancelled() && !github.event.act }}
+ uses: ./
+ with:
+ name: test_stack-deploy
+ file: docker-compose.yaml
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ pass: ${{ secrets.DOCKER_PASS }}
+ #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ compose: true
+ summary: false
- name: "4: Write YAML"
if: ${{ !cancelled() }}
@@ -112,10 +113,6 @@ jobs:
data: |
{"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
- - name: "4: Debug Compose"
- run: |
- cat "docker-compose.yaml"
-
- name: "4: Test Compose Auth"
if: ${{ !cancelled() }}
uses: ./
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0b59435..8bd3e0b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -3,7 +3,7 @@
> [!WARNING]
> This guide is a work in progress and may not be complete.
-This is a basic contributing guide and is a work in progress.
+Note: This guide is not updated for Compose but those tests work the same way.
## Workflow
diff --git a/README.md b/README.md
index 05e48cb..7dcb3a5 100644
--- a/README.md
+++ b/README.md
@@ -115,7 +115,7 @@ To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-
---
-🎉 Stack `test_stack-deploy` Successfully Deployed.
+🚀 Swarm Stack `test_stack-deploy` Successfully Deployed.
```text
docker stack deploy --detach=false --resolve-image=changed -c docker-compose.yaml test_stack-deploy
@@ -253,7 +253,7 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
```
Note: these are the default arguments. If you use `compose_args` this will override the default arguments unless they are included.
-You can disable them by passing an empty string.
+You can disable them by passing an empty string. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
Simple Workflow Example
diff --git a/src/main.sh b/src/main.sh
index 16f1cd9..939ca38 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -5,7 +5,7 @@ set -e
function cleanup_trap() {
_ST="$?"
- if [ -z "${INPUT_SSH_KEY}" ];then
+ if [[ -z "${INPUT_SSH_KEY}" ]];then
echo "🧹 Cleaning Up authorized_keys"
ssh -o BatchMode=yes -o ConnectTimeout=30 -p "${INPUT_PORT}" "${INPUT_USER}@${INPUT_HOST}" \
"sed -i '/docker-stack-deploy-action/d' ~/.ssh/authorized_keys"
@@ -19,6 +19,12 @@ function cleanup_trap() {
exit "${_ST}"
}
+## Set Variables
+
+if [[ "${INPUT_COMPOSE}" != "false" && "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
+ echo "::warning::You set compose_args but compose is false!"
+fi
+
SSH_DIR="/root/.ssh"
echo "::group::Starting Stack Deploy Action ${GITHUB_ACTION_REF}"
@@ -32,7 +38,9 @@ chmod 0700 "${SSH_DIR}" ~/.ssh
ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> "${SSH_DIR}/known_hosts"
echo "::endgroup::"
-if [ -z "${INPUT_SSH_KEY}" ];then
+## Setup Authentication
+
+if [[ -z "${INPUT_SSH_KEY}" ]];then
echo "::group::Copying SSH Key to Remote Host"
ssh-keygen -q -f "${SSH_DIR}/id_rsa" -N "" -C "docker-stack-deploy-action"
eval "$(ssh-agent -s)"
@@ -51,6 +59,8 @@ echo "::endgroup::"
trap cleanup_trap EXIT HUP INT QUIT PIPE TERM
+## Setup Docker Context
+
echo "::group::Verifying Remote Docker Context"
ssh -o BatchMode=yes -o ConnectTimeout=30 -p "${INPUT_PORT}" \
"${INPUT_USER}@${INPUT_HOST}" "docker info" > /dev/null
@@ -61,7 +71,9 @@ docker context use remote
docker context ls
echo "::endgroup::"
-if [ -n "${INPUT_ENV_FILE}" ];then
+## Export Environment File
+
+if [[ -f "${INPUT_ENV_FILE}" ]];then
echo -e "::group::Sourcing Environment File: \u001b[36;1m${INPUT_ENV_FILE}"
stat "${INPUT_ENV_FILE}"
set -a
@@ -70,6 +82,8 @@ if [ -n "${INPUT_ENV_FILE}" ];then
echo "::endgroup::"
fi
+## Docker Login
+
if [[ -n "${INPUT_REGISTRY_USER}" && -n "${INPUT_REGISTRY_PASS}" ]];then
echo -e "::group::Logging in to Registry: \u001b[36;1m${INPUT_REGISTRY_HOST:-Docker Hub}"
echo "${INPUT_REGISTRY_PASS}" |
@@ -78,6 +92,8 @@ if [[ -n "${INPUT_REGISTRY_USER}" && -n "${INPUT_REGISTRY_PASS}" ]];then
echo "::endgroup::"
fi
+## Collect Arguments
+
EXTRA_ARGS=()
if [[ "${INPUT_PRUNE}" != "false" ]];then
echo "::debug::Adding: --prune"
@@ -107,6 +123,8 @@ else
fi
fi
+## Deploy Stack
+
if [[ "${INPUT_COMPOSE}" != "false" ]];then
_type="Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
@@ -122,6 +140,8 @@ exec 5>&1
STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5))
echo "::endgroup::"
+## Write Summary
+
if [[ "${INPUT_SUMMARY}" == "true" ]];then
echo "📝 Writing Job Summary"
# shellcheck source=/src/summary.sh
From 22634f298be1699c2e725fe598aec6e1965d757f Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 15:43:53 -0700
Subject: [PATCH 17/48] Test Error
---
src/main.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/main.sh b/src/main.sh
index 939ca38..8d0dc67 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -138,6 +138,7 @@ echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5))
+_EXIT="$?"
echo "::endgroup::"
## Write Summary
@@ -148,3 +149,5 @@ if [[ "${INPUT_SUMMARY}" == "true" ]];then
source /src/summary.sh >> "${GITHUB_STEP_SUMMARY}" ||\
echo "::error::Failed to Write Job Summary!"
fi
+
+exit "${_EXIT}"
From 93a64c4cc6298c4a28983872cf2dd9f393e8304a Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 15:47:05 -0700
Subject: [PATCH 18/48] Test Error
---
src/main.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.sh b/src/main.sh
index 8d0dc67..9072f35 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -138,7 +138,7 @@ echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5))
-_EXIT="$?"
+EXIT_STATUS=${PIPESTATUS[0]}
echo "::endgroup::"
## Write Summary
@@ -150,4 +150,4 @@ if [[ "${INPUT_SUMMARY}" == "true" ]];then
echo "::error::Failed to Write Job Summary!"
fi
-exit "${_EXIT}"
+exit "${EXIT_STATUS}"
From 351dc421e06b5f924a8bce03c31809c515f0267c Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 15:50:17 -0700
Subject: [PATCH 19/48] Test Error
---
src/main.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main.sh b/src/main.sh
index 9072f35..16f1794 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -137,8 +137,7 @@ echo -e "::group::Deploying Docker ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
-STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5))
-EXIT_STATUS=${PIPESTATUS[0]}
+STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5));EXIT_STATUS=${PIPESTATUS[0]}
echo "::endgroup::"
## Write Summary
From 2f32e8b0f4728353f84b2eb517f31f0c3e3be9ca Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 16:46:07 -0700
Subject: [PATCH 20/48] Fix Error Capturing
---
src/main.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main.sh b/src/main.sh
index 16f1794..309e72c 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -137,7 +137,8 @@ echo -e "::group::Deploying Docker ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
# shellcheck disable=SC2034
-STACK_RESULTS=$("${COMMAND[@]}" 2>&1 | tee >(cat >&5));EXIT_STATUS=${PIPESTATUS[0]}
+STACK_RESULTS=$( "${COMMAND[@]}" 2>&1 | tee >(cat >&5) ;exit "${PIPESTATUS[0]}" )
+EXIT_STATUS="$?"
echo "::endgroup::"
## Write Summary
From 6235fc0e0e09b5f734d9a0bda94feae11cfff955 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 16:48:40 -0700
Subject: [PATCH 21/48] Fix Error Capturing
---
src/main.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/main.sh b/src/main.sh
index 309e72c..77b8537 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -136,9 +136,11 @@ fi
echo -e "::group::Deploying Docker ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
+set +e
# shellcheck disable=SC2034
STACK_RESULTS=$( "${COMMAND[@]}" 2>&1 | tee >(cat >&5) ;exit "${PIPESTATUS[0]}" )
EXIT_STATUS="$?"
+set -e
echo "::endgroup::"
## Write Summary
From 21527748c512d42c066f65e2890ba00d855fa747 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 16:53:32 -0700
Subject: [PATCH 22/48] Update Summary
---
src/summary.sh | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/summary.sh b/src/summary.sh
index 9ef6af0..c518628 100644
--- a/src/summary.sh
+++ b/src/summary.sh
@@ -1,10 +1,15 @@
#!/usr/bin/env bash
-
# shellcheck disable=SC2154
-cat << EOM
-## Stack Deploy Action
-🚀 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed.
+echo -e "## Stack Deploy Action\n"
+
+if [[ "${EXIT_STATUS}" == 0 ]];then
+ echo "🚀 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed."
+else
+ echo "⛔ ${_type} Stack \`${INPUT_NAME}\` Failed to Deploy!"
+fi
+
+cat << EOM
\`\`\`text
${COMMAND[*]}
From 57b6e198b3310594f21509340ede9ef18d5bad78 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 17:00:09 -0700
Subject: [PATCH 23/48] Fix Test
---
.github/workflows/test.yaml | 4 ++--
README.md | 21 ++++++++++++++++++++-
src/main.sh | 1 +
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index aa0905a..9db6cb0 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -95,7 +95,7 @@ jobs:
if: ${{ !cancelled() && !github.event.act }}
uses: ./
with:
- name: test_stack-deploy
+ name: test_stack-deploy-compose
file: docker-compose.yaml
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
@@ -117,7 +117,7 @@ jobs:
if: ${{ !cancelled() }}
uses: ./
with:
- name: test_stack-deploy
+ name: test_stack-deploy-compose
file: docker-compose.yaml
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
diff --git a/README.md b/README.md
index 7dcb3a5..4bdc5af 100644
--- a/README.md
+++ b/README.md
@@ -111,7 +111,7 @@ This is automatically set to `false` if you set `compose: true`.
To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
-👀 View Example Job Summary
+👀 View Example Successful Job Summary
---
@@ -142,6 +142,25 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
+👀 View Example Failure Job Summary
+
+⛔ Swarm Stack `test_stack-deploy` Failed to Deploy!
+
+```text
+docker stack deploy -c docker-compose.yaml --detach=false --resolve-image=changed test_stack-deploy
+```
+
+Results
+
+```text
+Creating network test_stack-deploy_default
+failed to create network test_stack-deploy_default: Error response from daemon: network with name test_stack-deploy_default already exists
+```
+
+
+
+
+
```yaml
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
diff --git a/src/main.sh b/src/main.sh
index 77b8537..d7f7495 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -3,6 +3,7 @@
set -e
+# shellcheck disable=SC2317
function cleanup_trap() {
_ST="$?"
if [[ -z "${INPUT_SSH_KEY}" ]];then
From 8b2805725cc1b5582be599540bfe159ff915abb8 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 17:08:45 -0700
Subject: [PATCH 24/48] Update summary.sh
---
README.md | 10 +++++++---
src/summary.sh | 13 ++++++++-----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 4bdc5af..c9af271 100644
--- a/README.md
+++ b/README.md
@@ -111,7 +111,7 @@ This is automatically set to `false` if you set `compose: true`.
To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
-👀 View Example Successful Job Summary
+👀 View Example ✔️ Successful Job Summary
---
@@ -142,7 +142,9 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
-👀 View Example Failure Job Summary
+👀 View Example ❌ Failure Job Summary
+
+---
⛔ Swarm Stack `test_stack-deploy` Failed to Deploy!
@@ -150,7 +152,7 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
docker stack deploy -c docker-compose.yaml --detach=false --resolve-image=changed test_stack-deploy
```
-Results
+Errors
```text
Creating network test_stack-deploy_default
@@ -159,6 +161,8 @@ failed to create network test_stack-deploy_default: Error response from daemon:
+---
+
```yaml
diff --git a/src/summary.sh b/src/summary.sh
index c518628..6f50621 100644
--- a/src/summary.sh
+++ b/src/summary.sh
@@ -1,21 +1,24 @@
#!/usr/bin/env bash
# shellcheck disable=SC2154
-echo -e "## Stack Deploy Action\n"
-
if [[ "${EXIT_STATUS}" == 0 ]];then
- echo "🚀 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed."
+ _result="🚀 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed."
+ _details="Results
"
else
- echo "⛔ ${_type} Stack \`${INPUT_NAME}\` Failed to Deploy!"
+ _result="⛔ ${_type} Stack \`${INPUT_NAME}\` Failed to Deploy!"
+ _details="Errors
"
fi
cat << EOM
+## Stack Deploy Action
+
+${_result}
\`\`\`text
${COMMAND[*]}
\`\`\`
-Results
+${_details}
\`\`\`text
${STACK_RESULTS}
From c056b92cad7a67a81e270c01ae139b45abae3a14 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 17:25:47 -0700
Subject: [PATCH 25/48] Cleanup
---
src/main.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.sh b/src/main.sh
index d7f7495..1f26962 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -139,7 +139,7 @@ echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
set +e
# shellcheck disable=SC2034
-STACK_RESULTS=$( "${COMMAND[@]}" 2>&1 | tee >(cat >&5) ;exit "${PIPESTATUS[0]}" )
+STACK_RESULTS=$( "${COMMAND[@]}" 2>&1 | tee >(cat >&5) ; exit "${PIPESTATUS[0]}" )
EXIT_STATUS="$?"
set -e
echo "::endgroup::"
From 0d9f2b5582dee031221f9b736458efa8d6bfd11b Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 18:07:15 -0700
Subject: [PATCH 26/48] Cleanup Prune Flag
---
README.md | 42 ++++++++++++++++++++++--------------------
action.yaml | 2 +-
src/main.sh | 19 ++++++++++++++-----
3 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
index c9af271..104f89c 100644
--- a/README.md
+++ b/README.md
@@ -39,26 +39,28 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
## Inputs
-| Input | Required | Default | Description |
-| :------------- | :----------: | :---------------------------------- | :---------------------------------------- |
-| name | **Yes** | - | Docker Stack/Project Name \* |
-| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
-| _compose_ | - | `false` | Use **Compose** instead of Swarm \* |
-| _compose_args_ | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
-| host | **Yes** | - | Remote Docker Hostname or IP \* |
-| port | - | `22` | Remote Docker Port |
-| user | **Yes** | - | Remote Docker Username |
-| pass | or `ssh_key` | - | Remote Docker Password \* |
-| ssh_key | or `pass` | - | Remote SSH Key File \* |
-| env_file | - | - | Docker Environment File \* |
-| detach | - | `true` | Detach Flag, `false` to disable \* |
-| prune | - | `false` | Prune Flag, `true` to enable |
-| resolve_image | - | `always` | Resolve [`always`, `changed`, `never`] \* |
-| registry_auth | - | - | Enable Registry Authentication \* |
-| registry_host | - | - | Registry Authentication Host \* |
-| registry_user | - | - | Registry Authentication Username \* |
-| registry_pass | - | - | Registry Authentication Password \* |
-| summary | - | `true` | Add Job Summary \* |
+| Input | Required | Default | Description |
+| :------------------ | :----------: | :---------------------------------- | :---------------------------------------- |
+| name | **Yes** | - | Docker Stack/Project Name \* |
+| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
+| _compose_ | - | `false` | Use **Compose** instead of Swarm \* |
+| _compose_args_ | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
+| host | **Yes** | - | Remote Docker Hostname or IP \* |
+| port | - | `22` | Remote Docker Port |
+| user | **Yes** | - | Remote Docker Username |
+| pass | or `ssh_key` | - | Remote Docker Password \* |
+| ssh_key | or `pass` | - | Remote SSH Key File \* |
+| env_file | - | - | Docker Environment File \* |
+| detach **¹** | - | `true` | Detach Flag, `false` to disable \* |
+| prune **¹** | - | `false` | Prune Flag, `true` to enable |
+| resolve_image **¹** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
+| registry_auth | - | - | Enable Registry Authentication \* |
+| registry_host | - | - | Registry Authentication Host \* |
+| registry_user | - | - | Registry Authentication Username \* |
+| registry_pass | - | - | Registry Authentication Password \* |
+| summary | - | `true` | Add Job Summary \* |
+
+> **¹** Swarm Hosts Only
_Swarm hosts, see the stack deploy [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/) for more details._
_Compose hosts, see the compose up [documentation](https://docs.docker.com/reference/cli/docker/compose/up/) for more details._
diff --git a/action.yaml b/action.yaml
index 205288a..fe5c46b 100644
--- a/action.yaml
+++ b/action.yaml
@@ -1,5 +1,5 @@
name: "Docker Stack Deploy"
-description: "Deploy a Docker Compose or Stack to a Remote Host over SSH w/ Optional Registry Authentication"
+description: "Deploy a Docker Compose or Swarm Stack to a Remote Host over SSH with Password or Key File Authentication"
author: "Shane"
branding:
icon: "layers"
diff --git a/src/main.sh b/src/main.sh
index 1f26962..379358e 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -39,6 +39,15 @@ chmod 0700 "${SSH_DIR}" ~/.ssh
ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> "${SSH_DIR}/known_hosts"
echo "::endgroup::"
+
+## Setup SSH
+
+echo "::group::Setup SSH Directory and Known Hosts"
+mkdir -p "${SSH_DIR}" ~/.ssh
+chmod 0700 "${SSH_DIR}" ~/.ssh
+ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> "${SSH_DIR}/known_hosts"
+echo "::endgroup::"
+
## Setup Authentication
if [[ -z "${INPUT_SSH_KEY}" ]];then
@@ -96,11 +105,6 @@ fi
## Collect Arguments
EXTRA_ARGS=()
-if [[ "${INPUT_PRUNE}" != "false" ]];then
- echo "::debug::Adding: --prune"
- EXTRA_ARGS+=("--prune")
-fi
-
if [[ "${INPUT_COMPOSE}" != "false" ]];then
echo "::debug::Adding: ${INPUT_COMPOSE_ARGS}"
read -r -a args <<< "${INPUT_COMPOSE_ARGS}"
@@ -114,6 +118,10 @@ else
echo "::debug::Adding: --detach=false"
EXTRA_ARGS+=("--detach=false")
fi
+ if [[ "${INPUT_PRUNE}" != "false" ]];then
+ echo "::debug::Adding: --prune"
+ EXTRA_ARGS+=("--prune")
+ fi
if [[ "${INPUT_RESOLVE_IMAGE}" != "always" ]];then
if [[ "${INPUT_RESOLVE_IMAGE}" == "changed" || "${INPUT_RESOLVE_IMAGE}" == "never" ]];then
echo "::debug::Adding: --resolve-image=${INPUT_RESOLVE_IMAGE}"
@@ -153,4 +161,5 @@ if [[ "${INPUT_SUMMARY}" == "true" ]];then
echo "::error::Failed to Write Job Summary!"
fi
+echo "::debug::EXIT_STATUS: ${EXIT_STATUS}"
exit "${EXIT_STATUS}"
From 8862d57e2549c6de4e3c6b186acdda9c4c2314a4 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 18:36:24 -0700
Subject: [PATCH 27/48] Update Input Warnings
---
src/main.sh | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/main.sh b/src/main.sh
index 379358e..b54b697 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -22,8 +22,21 @@ function cleanup_trap() {
## Set Variables
-if [[ "${INPUT_COMPOSE}" != "false" && "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
- echo "::warning::You set compose_args but compose is false!"
+#if [[ "${INPUT_COMPOSE}" != "false" && "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
+if [[ "${INPUT_COMPOSE}" == "false" ]];then
+ if [[ "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
+ echo "::warning::You set compose_args but compose is false!"
+ fi
+else
+ if [[ "${INPUT_DETACH}" != "true" ]];then
+ echo "::warning::You set detach but compose is true!"
+ fi
+ if [[ "${INPUT_PRUNE}" != "false" ]];then
+ echo "::warning::You set prune but compose is true!"
+ fi
+ if [[ "${INPUT_RESOLVE_IMAGE}" != "always" ]];then
+ echo "::warning::You set resolve_image but compose is true!"
+ fi
fi
SSH_DIR="/root/.ssh"
@@ -34,12 +47,8 @@ echo "Script: ${0}"
echo "Current Directory: $(pwd)"
echo "Home Directory: ${HOME}"
echo "SSH Directory: ${SSH_DIR}"
-mkdir -p "${SSH_DIR}" ~/.ssh
-chmod 0700 "${SSH_DIR}" ~/.ssh
-ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> "${SSH_DIR}/known_hosts"
echo "::endgroup::"
-
## Setup SSH
echo "::group::Setup SSH Directory and Known Hosts"
From 52e30c485ac806d7056d4b9f5964460240a6997f Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 18:44:05 -0700
Subject: [PATCH 28/48] Remove unused block
---
README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
src/main.sh | 8 +++-----
2 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 104f89c..83fdbd8 100644
--- a/README.md
+++ b/README.md
@@ -202,7 +202,7 @@ failed to create network test_stack-deploy_default: Error response from daemon:
```
-With SSH key, --prune, --detach=false and --resolve-image=changed
+With SSH Key, --prune, --detach=false and --resolve-image=changed
```yaml
- name: 'Stack Deploy'
@@ -220,7 +220,7 @@ failed to create network test_stack-deploy_default: Error response from daemon:
```
-With All Inputs
+With All Swarm Inputs
```yaml
- name: 'Stack Deploy'
@@ -280,6 +280,52 @@ failed to create network test_stack-deploy_default: Error response from daemon:
Note: these are the default arguments. If you use `compose_args` this will override the default arguments unless they are included.
You can disable them by passing an empty string. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
+
+Compose with Private Image
+
+```yaml
+- name: 'Compose Deploy'
+ uses: cssnr/stack-deploy-action@v1
+ with:
+ name: 'stack-name'
+ file: 'docker-compose.yaml'
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ registry_host: 'ghcr.io'
+ registry_user: ${{ vars.GHCR_USER }}
+ registry_pass: ${{ secrets.GHCR_PASS }}
+ compose: true
+ compose_args: --remove-orphans --force-recreate
+```
+
+Note: these are the default arguments. If you use `compose_args` this will override the default arguments unless they are included.
+You can disable them by passing an empty string. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
+
+
+With All Compose Inputs
+
+```yaml
+- name: 'Stack Deploy'
+ uses: cssnr/stack-deploy-action@v1
+ with:
+ name: 'stack-name'
+ file: 'docker-compose-swarm.yaml'
+ host: ${{ secrets.DOCKER_HOST }}
+ port: ${{ secrets.DOCKER_PORT }}
+ user: ${{ secrets.DOCKER_USER }}
+ pass: ${{ secrets.DOCKER_PASS }} # not needed with ssh_key
+ ssh_key: ${{ secrets.DOCKER_SSH_KEY }} # not needed with pass
+ env_file: 'stack.env'
+ registry_host: 'ghcr.io'
+ registry_user: ${{ vars.GHCR_USER }}
+ registry_pass: ${{ secrets.GHCR_PASS }}
+ compose: true
+ compose_args: --remove-orphans --force-recreate
+ summary: true
+```
+
Simple Workflow Example
diff --git a/src/main.sh b/src/main.sh
index b54b697..4940ba1 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -20,7 +20,7 @@ function cleanup_trap() {
exit "${_ST}"
}
-## Set Variables
+## Check Variables
#if [[ "${INPUT_COMPOSE}" != "false" && "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
if [[ "${INPUT_COMPOSE}" == "false" ]];then
@@ -39,6 +39,8 @@ else
fi
fi
+## Setup Script
+
SSH_DIR="/root/.ssh"
echo "::group::Starting Stack Deploy Action ${GITHUB_ACTION_REF}"
@@ -47,11 +49,7 @@ echo "Script: ${0}"
echo "Current Directory: $(pwd)"
echo "Home Directory: ${HOME}"
echo "SSH Directory: ${SSH_DIR}"
-echo "::endgroup::"
-
-## Setup SSH
-echo "::group::Setup SSH Directory and Known Hosts"
mkdir -p "${SSH_DIR}" ~/.ssh
chmod 0700 "${SSH_DIR}" ~/.ssh
ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> "${SSH_DIR}/known_hosts"
From d69254bf0a7079558255ccbc451cda50ff068f94 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 18:54:48 -0700
Subject: [PATCH 29/48] Update README.md
---
README.md | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 83fdbd8..2487287 100644
--- a/README.md
+++ b/README.md
@@ -62,8 +62,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
> **¹** Swarm Hosts Only
-_Swarm hosts, see the stack deploy [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/) for more details._
-_Compose hosts, see the compose up [documentation](https://docs.docker.com/reference/cli/docker/compose/up/) for more details._
+_For more information, see the [Swarm docs](https://docs.docker.com/reference/cli/docker/stack/deploy/) or [Compose docs](https://docs.docker.com/reference/cli/docker/compose/up/)._
📟 Click Here to see how the deployment command is generated
@@ -101,9 +100,9 @@ If using `compose: true` you can add the `compose_arg: --env-file stringArray`.
This will generate extra output in the logs and is useful for debugging deployments.
This is automatically set to `false` if you set `compose: true`.
-**resolve_image** - When the default `always` is used, this argument is omitted. Swarm only.
+**resolve_image** - When the default `always` is used, this argument is omitted. _Swarm only._
-**registry_auth** - Set to `true` to deploy with `--with-registry-auth`. Swarm only.
+**registry_auth** - Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
**registry_host** - To run `docker login` on another registry. Example: `ghcr.io`
@@ -184,7 +183,7 @@ failed to create network test_stack-deploy_default: Error response from daemon:
💡 _Click on an example heading to expand or collapse the example._
-With password, docker login and --with-registry-auth
+With Password, docker login and --with-registry-auth
```yaml
- name: 'Stack Deploy'
From 96bffef62b350f36d91005add3d145fe48626f1b Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 18:58:52 -0700
Subject: [PATCH 30/48] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 2487287..8fcad7f 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| detach **¹** | - | `true` | Detach Flag, `false` to disable \* |
| prune **¹** | - | `false` | Prune Flag, `true` to enable |
| resolve_image **¹** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
-| registry_auth | - | - | Enable Registry Authentication \* |
+| registry_auth **¹** | - | - | Enable Registry Authentication \* |
| registry_host | - | - | Registry Authentication Host \* |
| registry_user | - | - | Registry Authentication Username \* |
| registry_pass | - | - | Registry Authentication Password \* |
@@ -98,7 +98,7 @@ If using `compose: true` you can add the `compose_arg: --env-file stringArray`.
**detach** - Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
-This is automatically set to `false` if you set `compose: true`.
+This is automatically set to `false` if you set `compose: true`. _Swarm only._
**resolve_image** - When the default `always` is used, this argument is omitted. _Swarm only._
From 017c2f517b07f0b7499106ee7d12fa66b5b1d9f1 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:04:49 -0700
Subject: [PATCH 31/48] Rename Inputs
---
.github/workflows/test.yaml | 4 +--
README.md | 52 ++++++++++++++++++-------------------
action.yaml | 8 +++---
src/main.sh | 39 ++++++++++++++++------------
4 files changed, 53 insertions(+), 50 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 9db6cb0..4b39bfe 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -102,7 +102,7 @@ jobs:
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
#ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- compose: true
+ mode: compose
summary: false
- name: "4: Write YAML"
@@ -124,7 +124,7 @@ jobs:
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
#ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- compose: true
+ mode: compose
registry_user: ${{ vars.DOCKER_HUB_USER }}
registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
diff --git a/README.md b/README.md
index 8fcad7f..27ffa9e 100644
--- a/README.md
+++ b/README.md
@@ -43,36 +43,37 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| :------------------ | :----------: | :---------------------------------- | :---------------------------------------- |
| name | **Yes** | - | Docker Stack/Project Name \* |
| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
-| _compose_ | - | `false` | Use **Compose** instead of Swarm \* |
-| _compose_args_ | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
+| _mode_ **¹** | - | `swarm` | Deploy Mode: [`swarm`, `compose`] \* |
+| _args_ **¹** | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
| host | **Yes** | - | Remote Docker Hostname or IP \* |
| port | - | `22` | Remote Docker Port |
| user | **Yes** | - | Remote Docker Username |
| pass | or `ssh_key` | - | Remote Docker Password \* |
| ssh_key | or `pass` | - | Remote SSH Key File \* |
| env_file | - | - | Docker Environment File \* |
-| detach **¹** | - | `true` | Detach Flag, `false` to disable \* |
-| prune **¹** | - | `false` | Prune Flag, `true` to enable |
-| resolve_image **¹** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
-| registry_auth **¹** | - | - | Enable Registry Authentication \* |
+| detach **²** | - | `true` | Detach Flag, `false` to disable \* |
+| prune **²** | - | `false` | Prune Flag, `true` to enable |
+| resolve_image **²** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
+| registry_auth **²** | - | - | Enable Registry Authentication \* |
| registry_host | - | - | Registry Authentication Host \* |
| registry_user | - | - | Registry Authentication Username \* |
| registry_pass | - | - | Registry Authentication Password \* |
| summary | - | `true` | Add Job Summary \* |
-> **¹** Swarm Hosts Only
+> **¹** Compose Only
+> **²** Swarm Only
_For more information, see the [Swarm docs](https://docs.docker.com/reference/cli/docker/stack/deploy/) or [Compose docs](https://docs.docker.com/reference/cli/docker/compose/up/)._
📟 Click Here to see how the deployment command is generated
```shell
-if [[ "${INPUT_COMPOSE}" != "false" ]];then
- _type="Compose"
- COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
-else
+if [[ "${INPUT_MODE}" == "swarm" ]];then
_type="Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
+else
+ _type="Compose"
+ COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
fi
```
@@ -80,11 +81,12 @@ fi
**name** - Stack name for Swarm and project name for Compose.
-**compose** - Set this to `true` to use `compose up` instead of `stack deploy` for non-swarm Docker hosts.
+**mode** - Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
-**compose_args** - Arguments to pass to the `compose up` command. Only used for `compose: true` deployments.
+**args** - Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
-Use an empty string to override. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
+Use an empty string to override. For more details, see the compose up
+[docs](https://docs.docker.com/reference/cli/docker/compose/up/). _Compose only._
**host** - The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
@@ -94,11 +96,11 @@ If your hostname is behind a proxy like Cloudflare you will need to use the IP a
**env_file** - Variables in this file are exported before running stack deploy.
To use a docker `env_file` specify it in your compose file and make it available in a previous step.
If you need compose file templating this can also be done in a previous step.
-If using `compose: true` you can add the `compose_arg: --env-file stringArray`.
+If using `mode: compose` you can add the `compose_arg: --env-file stringArray`.
**detach** - Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
-This is automatically set to `false` if you set `compose: true`. _Swarm only._
+This is automatically set to `false` if you set `mode: compose`. _Swarm only._
**resolve_image** - When the default `always` is used, this argument is omitted. _Swarm only._
@@ -256,7 +258,7 @@ failed to create network test_stack-deploy_default: Error response from daemon:
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- compose: true
+ mode: compose
```
@@ -272,11 +274,11 @@ failed to create network test_stack-deploy_default: Error response from daemon:
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
- compose: true
- compose_args: --remove-orphans --force-recreate
+ mode: compose
+ args: --remove-orphans --force-recreate
```
-Note: these are the default arguments. If you use `compose_args` this will override the default arguments unless they are included.
+Note: these are the default arguments. If you use `args` this will override the default arguments unless they are included.
You can disable them by passing an empty string. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
@@ -295,13 +297,9 @@ You can disable them by passing an empty string. For more details, see the compo
registry_host: 'ghcr.io'
registry_user: ${{ vars.GHCR_USER }}
registry_pass: ${{ secrets.GHCR_PASS }}
- compose: true
- compose_args: --remove-orphans --force-recreate
+ mode: compose
```
-Note: these are the default arguments. If you use `compose_args` this will override the default arguments unless they are included.
-You can disable them by passing an empty string. For more details, see the compose up [docs](https://docs.docker.com/reference/cli/docker/compose/up/).
-
With All Compose Inputs
@@ -320,8 +318,8 @@ You can disable them by passing an empty string. For more details, see the compo
registry_host: 'ghcr.io'
registry_user: ${{ vars.GHCR_USER }}
registry_pass: ${{ secrets.GHCR_PASS }}
- compose: true
- compose_args: --remove-orphans --force-recreate
+ mode: compose
+ args: --remove-orphans --force-recreate
summary: true
```
diff --git a/action.yaml b/action.yaml
index fe5c46b..5cd86dd 100644
--- a/action.yaml
+++ b/action.yaml
@@ -13,11 +13,11 @@ inputs:
description: "Docker Compose File"
required: false
default: "docker-compose.yaml"
- compose:
- description: "Use Compose"
+ mode:
+ description: "Deploy Mode"
required: false
- default: "false"
- compose_args:
+ default: "swarm"
+ args:
description: "Compose Arguments"
required: false
default: "--remove-orphans --force-recreate"
diff --git a/src/main.sh b/src/main.sh
index 4940ba1..77443e9 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -22,21 +22,24 @@ function cleanup_trap() {
## Check Variables
-#if [[ "${INPUT_COMPOSE}" != "false" && "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
-if [[ "${INPUT_COMPOSE}" == "false" ]];then
- if [[ "${INPUT_COMPOSE_ARGS}" != "--remove-orphans --force-recreate" ]];then
- echo "::warning::You set compose_args but compose is false!"
+if [[ "${INPUT_MODE}" == "swarm" ]];then
+ if [[ "${INPUT_ARGS}" != "--remove-orphans --force-recreate" ]];then
+ echo "::warning::You set compose args but mode is swarm!"
fi
else
+#elif [[ "${INPUT_MODE}" == "compose" ]];then
if [[ "${INPUT_DETACH}" != "true" ]];then
- echo "::warning::You set detach but compose is true!"
+ echo "::warning::You set detach but mode is compose!"
fi
if [[ "${INPUT_PRUNE}" != "false" ]];then
- echo "::warning::You set prune but compose is true!"
+ echo "::warning::You set prune but mode is compose!"
fi
if [[ "${INPUT_RESOLVE_IMAGE}" != "always" ]];then
- echo "::warning::You set resolve_image but compose is true!"
+ echo "::warning::You set resolve_image but mode is compose!"
fi
+#else
+# echo "::error::Input mode must be set to swarm or compose!"
+# exit 1
fi
## Setup Script
@@ -112,11 +115,8 @@ fi
## Collect Arguments
EXTRA_ARGS=()
-if [[ "${INPUT_COMPOSE}" != "false" ]];then
- echo "::debug::Adding: ${INPUT_COMPOSE_ARGS}"
- read -r -a args <<< "${INPUT_COMPOSE_ARGS}"
- EXTRA_ARGS+=("${args[@]}")
-else
+if [[ "${INPUT_MODE}" == "swarm" ]];then
+ echo "::debug::Processing Swarm Arguments"
if [[ -n "${INPUT_REGISTRY_AUTH}" ]];then
echo "::debug::Adding: --with-registry-auth"
EXTRA_ARGS+=("--with-registry-auth")
@@ -134,19 +134,24 @@ else
echo "::debug::Adding: --resolve-image=${INPUT_RESOLVE_IMAGE}"
EXTRA_ARGS+=("--resolve-image=${INPUT_RESOLVE_IMAGE}")
else
- echo "::error::Input resolve_image must be one of: always, changed, never"
+ echo "::warning::Input resolve_image must be one of: always, changed, never"
fi
fi
+else
+ echo "::debug::Processing Compose Arguments"
+ echo "::debug::Adding: ${INPUT_ARGS}"
+ read -r -a args <<< "${INPUT_ARGS}"
+ EXTRA_ARGS+=("${args[@]}")
fi
## Deploy Stack
-if [[ "${INPUT_COMPOSE}" != "false" ]];then
- _type="Compose"
- COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
-else
+if [[ "${INPUT_MODE}" == "swarm" ]];then
_type="Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
+else
+ _type="Compose"
+ COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
fi
echo -e "::group::Deploying Docker ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
From d0f03d0aa1caef61f8c145e739e14c8cadf428a1 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:13:37 -0700
Subject: [PATCH 32/48] Update README.md
---
README.md | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 27ffa9e..2c3e471 100644
--- a/README.md
+++ b/README.md
@@ -60,10 +60,8 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| registry_pass | - | - | Registry Authentication Password \* |
| summary | - | `true` | Add Job Summary \* |
-> **¹** Compose Only
-> **²** Swarm Only
-
-_For more information, see the [Swarm docs](https://docs.docker.com/reference/cli/docker/stack/deploy/) or [Compose docs](https://docs.docker.com/reference/cli/docker/compose/up/)._
+> **¹** Compose Only. View the [documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
+> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
📟 Click Here to see how the deployment command is generated
@@ -114,7 +112,7 @@ This is automatically set to `false` if you set `mode: compose`. _Swarm only._
To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
-👀 View Example ✔️ Successful Job Summary
+👀 View Example Successful ✔️ Job Summary
---
@@ -145,7 +143,7 @@ verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
-👀 View Example ❌ Failure Job Summary
+👀 View Example Failure ❌ Job Summary
---
From b14908944d8f614a6f5b5c402e0cbd789abade63 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:15:56 -0700
Subject: [PATCH 33/48] Update README.md
---
README.md | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
index 2c3e471..5ecd495 100644
--- a/README.md
+++ b/README.md
@@ -39,26 +39,26 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
## Inputs
-| Input | Required | Default | Description |
-| :------------------ | :----------: | :---------------------------------- | :---------------------------------------- |
-| name | **Yes** | - | Docker Stack/Project Name \* |
-| file | - | `docker-compose.yaml` | Docker Stack/Compose File |
-| _mode_ **¹** | - | `swarm` | Deploy Mode: [`swarm`, `compose`] \* |
-| _args_ **¹** | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
-| host | **Yes** | - | Remote Docker Hostname or IP \* |
-| port | - | `22` | Remote Docker Port |
-| user | **Yes** | - | Remote Docker Username |
-| pass | or `ssh_key` | - | Remote Docker Password \* |
-| ssh_key | or `pass` | - | Remote SSH Key File \* |
-| env_file | - | - | Docker Environment File \* |
-| detach **²** | - | `true` | Detach Flag, `false` to disable \* |
-| prune **²** | - | `false` | Prune Flag, `true` to enable |
-| resolve_image **²** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
-| registry_auth **²** | - | - | Enable Registry Authentication \* |
-| registry_host | - | - | Registry Authentication Host \* |
-| registry_user | - | - | Registry Authentication Username \* |
-| registry_pass | - | - | Registry Authentication Password \* |
-| summary | - | `true` | Add Job Summary \* |
+| Input | Required | Default | Description |
+| :-------------------- | :----------: | :---------------------------------- | :---------------------------------------- |
+| `name` | **Yes** | - | Docker Stack/Project Name \* |
+| `file` | - | `docker-compose.yaml` | Docker Stack/Compose File |
+| `mode` **¹** | - | `swarm` | Deploy Mode: [`swarm`, `compose`] \* |
+| `args` **¹** | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
+| `host` | **Yes** | - | Remote Docker Hostname or IP \* |
+| `port` | - | `22` | Remote Docker Port |
+| `user` | **Yes** | - | Remote Docker Username |
+| `pass` | or `ssh_key` | - | Remote Docker Password \* |
+| `ssh_key` | or `pass` | - | Remote SSH Key File \* |
+| `env_file` | - | - | Docker Environment File \* |
+| `detach` **²** | - | `true` | Detach Flag, `false` to disable \* |
+| `prune` **²** | - | `false` | Prune Flag, `true` to enable |
+| `resolve_image` **²** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
+| `registry_auth` **²** | - | - | Enable Registry Authentication \* |
+| `registry_host` | - | - | Registry Authentication Host \* |
+| `registry_user` | - | - | Registry Authentication Username \* |
+| `registry_pass` | - | - | Registry Authentication Password \* |
+| `summary` | - | `true` | Add Job Summary \* |
> **¹** Compose Only. View the [documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
From 3a1917ed73ec7369722ed7f8629f0177be3036f3 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:20:16 -0700
Subject: [PATCH 34/48] Update README.md
---
README.md | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
index 5ecd495..056bc2e 100644
--- a/README.md
+++ b/README.md
@@ -39,26 +39,26 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
## Inputs
-| Input | Required | Default | Description |
-| :-------------------- | :----------: | :---------------------------------- | :---------------------------------------- |
-| `name` | **Yes** | - | Docker Stack/Project Name \* |
-| `file` | - | `docker-compose.yaml` | Docker Stack/Compose File |
-| `mode` **¹** | - | `swarm` | Deploy Mode: [`swarm`, `compose`] \* |
-| `args` **¹** | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
-| `host` | **Yes** | - | Remote Docker Hostname or IP \* |
-| `port` | - | `22` | Remote Docker Port |
-| `user` | **Yes** | - | Remote Docker Username |
-| `pass` | or `ssh_key` | - | Remote Docker Password \* |
-| `ssh_key` | or `pass` | - | Remote SSH Key File \* |
-| `env_file` | - | - | Docker Environment File \* |
-| `detach` **²** | - | `true` | Detach Flag, `false` to disable \* |
-| `prune` **²** | - | `false` | Prune Flag, `true` to enable |
-| `resolve_image` **²** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
-| `registry_auth` **²** | - | - | Enable Registry Authentication \* |
-| `registry_host` | - | - | Registry Authentication Host \* |
-| `registry_user` | - | - | Registry Authentication Username \* |
-| `registry_pass` | - | - | Registry Authentication Password \* |
-| `summary` | - | `true` | Add Job Summary \* |
+| Input | Required | Default | Description |
+| :------------------- | :----------: | :---------------------------------- | :---------------------------------------- |
+| `name` | **Yes** | - | Docker Stack/Project Name \* |
+| `file` | - | `docker-compose.yaml` | Docker Stack/Compose File |
+| `mode`**¹** | - | `swarm` | Deploy Mode: [`swarm`, `compose`] \* |
+| `args`**¹** | - | `--remove-orphans --force-recreate` | Additional Arguments for **Compose** \* |
+| `host` | **Yes** | - | Remote Docker Hostname or IP \* |
+| `port` | - | `22` | Remote Docker Port |
+| `user` | **Yes** | - | Remote Docker Username |
+| `pass` | or `ssh_key` | - | Remote Docker Password \* |
+| `ssh_key` | or `pass` | - | Remote SSH Key File \* |
+| `env_file` | - | - | Docker Environment File \* |
+| `detach`**²** | - | `true` | Detach Flag, `false` to disable \* |
+| `prune`**²** | - | `false` | Prune Flag, `true` to enable |
+| `resolve_image`**²** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
+| `registry_auth`**²** | - | - | Enable Registry Authentication \* |
+| `registry_host` | - | - | Registry Authentication Host \* |
+| `registry_user` | - | - | Registry Authentication Username \* |
+| `registry_pass` | - | - | Registry Authentication Password \* |
+| `summary` | - | `true` | Add Job Summary \* |
> **¹** Compose Only. View the [documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
From b0c259ffb4d96c0a80f19e3491cd33cfea794b62 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:23:04 -0700
Subject: [PATCH 35/48] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 056bc2e..ddd4fb1 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,8 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| `summary` | - | `true` | Add Job Summary \* |
> **¹** Compose Only. View the [documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
-> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
+> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
+> \* See below for details.
📟 Click Here to see how the deployment command is generated
From 67cbbb80f132b198a94337688443a04a97cfeb66 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:25:47 -0700
Subject: [PATCH 36/48] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index ddd4fb1..332531e 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
> **¹** Compose Only. View the [documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
-> \* See below for details.
+> **\*** More Details Below...
📟 Click Here to see how the deployment command is generated
From 31f4783938c909d58f46d5d3b4b9631bf2d07768 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:34:36 -0700
Subject: [PATCH 37/48] Update README.md
---
README.md | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 332531e..a6b50ae 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,8 @@
- [Contributing](#Contributing)
> [!TIP]
-> 💡 Now works with vanilla Docker hosts using **Compose. No Swarm Required!**
+> 💡 Now works with vanilla Docker hosts using **Compose. No Swarm Required!**
+> Just set `mode: compose`. See the [Inputs](#Inputs) for more details...
This action deploys a docker stack from a compose file to a remote docker host using SSH Password or Key File Authentication.
You can also optionally authenticate against a private registry using a username and password.
@@ -60,9 +61,9 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| `registry_pass` | - | - | Registry Authentication Password \* |
| `summary` | - | `true` | Add Job Summary \* |
-> **¹** Compose Only. View the [documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
-> **²** Swarm Only. View the [documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
-> **\*** More Details Below...
+> **¹** Compose Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
+> **²** Swarm Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
+> \* More Details Below...
📟 Click Here to see how the deployment command is generated
@@ -95,17 +96,17 @@ If your hostname is behind a proxy like Cloudflare you will need to use the IP a
**env_file** - Variables in this file are exported before running stack deploy.
To use a docker `env_file` specify it in your compose file and make it available in a previous step.
If you need compose file templating this can also be done in a previous step.
-If using `mode: compose` you can add the `compose_arg: --env-file stringArray`.
+If using `mode: compose` you can also add the `compose_arg: --env-file stringArray`.
**detach** - Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
-This is automatically set to `false` if you set `mode: compose`. _Swarm only._
+Defaults to `false` in `mode: compose`. _Swarm only._
**resolve_image** - When the default `always` is used, this argument is omitted. _Swarm only._
**registry_auth** - Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
-**registry_host** - To run `docker login` on another registry. Example: `ghcr.io`
+**registry_host** - To run `docker login` on another registry. Example: `ghcr.io`.
**registry_user/registry_pass** - Required to run `docker login` before stack deploy.
From 5ced89e6ee4ce4dc8702ddb63bf66b9e744f5d94 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:37:19 -0700
Subject: [PATCH 38/48] Tweaks
---
README.md | 4 ++--
src/main.sh | 6 +++---
src/summary.sh | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index a6b50ae..c550e3a 100644
--- a/README.md
+++ b/README.md
@@ -69,10 +69,10 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
```shell
if [[ "${INPUT_MODE}" == "swarm" ]];then
- _type="Swarm"
+ DEPLOY_TYPE="Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
else
- _type="Compose"
+ DEPLOY_TYPE="Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
fi
```
diff --git a/src/main.sh b/src/main.sh
index 77443e9..bfd5220 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -147,14 +147,14 @@ fi
## Deploy Stack
if [[ "${INPUT_MODE}" == "swarm" ]];then
- _type="Swarm"
+ DEPLOY_TYPE="Swarm"
COMMAND=("docker" "stack" "deploy" "-c" "${INPUT_FILE}" "${EXTRA_ARGS[@]}" "${INPUT_NAME}")
else
- _type="Compose"
+ DEPLOY_TYPE="Compose"
COMMAND=("docker" "compose" "-f" "${INPUT_FILE}" "-p" "${INPUT_NAME}" "up" "-d" "-y" "${EXTRA_ARGS[@]}")
fi
-echo -e "::group::Deploying Docker ${_type} Stack: \u001b[36;1m${INPUT_NAME}"
+echo -e "::group::Deploying Docker ${DEPLOY_TYPE} Stack: \u001b[36;1m${INPUT_NAME}"
echo -e "\u001b[33;1m${COMMAND[*]}\n"
exec 5>&1
set +e
diff --git a/src/summary.sh b/src/summary.sh
index 6f50621..4c307e1 100644
--- a/src/summary.sh
+++ b/src/summary.sh
@@ -2,10 +2,10 @@
# shellcheck disable=SC2154
if [[ "${EXIT_STATUS}" == 0 ]];then
- _result="🚀 ${_type} Stack \`${INPUT_NAME}\` Successfully Deployed."
+ _result="🚀 ${DEPLOY_TYPE} Stack \`${INPUT_NAME}\` Successfully Deployed."
_details="Results
"
else
- _result="⛔ ${_type} Stack \`${INPUT_NAME}\` Failed to Deploy!"
+ _result="⛔ ${DEPLOY_TYPE} Stack \`${INPUT_NAME}\` Failed to Deploy!"
_details="Errors
"
fi
From 4a1d7511743786f0f146aea560d8251ddf810e23 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:38:35 -0700
Subject: [PATCH 39/48] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c550e3a..091b1f1 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
> **¹** Compose Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
> **²** Swarm Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
-> \* More Details Below...
+> \* See Below for More Details...
📟 Click Here to see how the deployment command is generated
From 8aa20517a21fa9242f0f78426de1f5b7ee7b3a8e Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:41:44 -0700
Subject: [PATCH 40/48] Update test.yaml
---
.github/workflows/test.yaml | 6 +++---
README.md | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 4b39bfe..0cf3b90 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -113,7 +113,7 @@ jobs:
data: |
{"version":"3.8","services":{"alpine":{"image":"${{ env.PRIVATE_IMAGE }}","command":"tail -f /dev/null"}}}
- - name: "4: Test Compose Auth"
+ - name: "4: Test Compose SSH and Auth"
if: ${{ !cancelled() }}
uses: ./
with:
@@ -122,8 +122,8 @@ jobs:
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
- pass: ${{ secrets.DOCKER_PASS }}
- #ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
+ #pass: ${{ secrets.DOCKER_PASS }}
+ ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
mode: compose
registry_user: ${{ vars.DOCKER_HUB_USER }}
registry_pass: ${{ secrets.DOCKER_HUB_PASS }}
diff --git a/README.md b/README.md
index 091b1f1..3c6c44f 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
> **¹** Compose Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
> **²** Swarm Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
-> \* See Below for More Details...
+> \* See Below for more details...
📟 Click Here to see how the deployment command is generated
From aef0a7de899bdd9462ac0dae77d4200c1a8d3804 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:52:27 -0700
Subject: [PATCH 41/48] Update README.md
---
README.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/README.md b/README.md
index 3c6c44f..81d2769 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@
- [Inputs](#Inputs)
- [Examples](#Examples)
- [Tags](#Tags)
+- [Features](#Features)
- [Support](#Support)
- [Contributing](#Contributing)
@@ -468,6 +469,17 @@ The following rolling [tags](https://github.com/cssnr/stack-deploy-action/tags)
You can view the release notes for each version on the [releases](https://github.com/cssnr/stack-deploy-action/releases) page.
+## Features
+
+- Deploy to a remote host using SSH or Password authentication.
+- Deploy using a remote context from the current working directory.
+- Deploy from a compose file to either a Docker Swarm or Compose host.
+- Displays output in logs, captures it in the Summary, and checks the status.
+- Allows logging into a private registry and deploying with registry auth.
+- Allows specifying all arguments for both Swarm and Compose deployments.
+
+Don't see your feature here? Request it below in the [Support](#Support) section.
+
# Support
For general help or to request a feature see:
From 86417b45708da735381206b010325771e8fa7224 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:55:06 -0700
Subject: [PATCH 42/48] Update README.md
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 81d2769..1d1d904 100644
--- a/README.md
+++ b/README.md
@@ -82,9 +82,9 @@ fi
**name** - Stack name for Swarm and project name for Compose.
-**mode** - Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
+**mode ¹** - Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
-**args** - Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
+**args ¹** - Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
Use an empty string to override. For more details, see the compose up
[docs](https://docs.docker.com/reference/cli/docker/compose/up/). _Compose only._
@@ -99,13 +99,13 @@ To use a docker `env_file` specify it in your compose file and make it available
If you need compose file templating this can also be done in a previous step.
If using `mode: compose` you can also add the `compose_arg: --env-file stringArray`.
-**detach** - Set this to `false` to not exit immediately and wait for the services to converge.
+**detach ²** - Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
Defaults to `false` in `mode: compose`. _Swarm only._
-**resolve_image** - When the default `always` is used, this argument is omitted. _Swarm only._
+**resolve_image ²** - When the default `always` is used, this argument is omitted. _Swarm only._
-**registry_auth** - Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
+**registry_auth ²** - Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
**registry_host** - To run `docker login` on another registry. Example: `ghcr.io`.
From 3002d83eeb80d8260f08aa8a4d5847d84474b86a Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:57:54 -0700
Subject: [PATCH 43/48] Update README.md
---
README.md | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 1d1d904..60b813a 100644
--- a/README.md
+++ b/README.md
@@ -80,38 +80,38 @@ fi
-**name** - Stack name for Swarm and project name for Compose.
+**name**: Stack name for Swarm and project name for Compose.
-**mode ¹** - Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
+**mode**¹: Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
-**args ¹** - Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
+**args**¹: Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
Use an empty string to override. For more details, see the compose up
[docs](https://docs.docker.com/reference/cli/docker/compose/up/). _Compose only._
-**host** - The hostname or IP address of the remote docker server to deploy too.
+**host**: The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
-**pass/ssh_key** - You must provide either a `pass` or `ssh_key`, but not both.
+**pass/ssh_key**: You must provide either a `pass` or `ssh_key`, but not both.
-**env_file** - Variables in this file are exported before running stack deploy.
+**env_file**: Variables in this file are exported before running stack deploy.
To use a docker `env_file` specify it in your compose file and make it available in a previous step.
If you need compose file templating this can also be done in a previous step.
If using `mode: compose` you can also add the `compose_arg: --env-file stringArray`.
-**detach ²** - Set this to `false` to not exit immediately and wait for the services to converge.
+**detach**²: Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
Defaults to `false` in `mode: compose`. _Swarm only._
-**resolve_image ²** - When the default `always` is used, this argument is omitted. _Swarm only._
+**resolve_image**²: When the default `always` is used, this argument is omitted. _Swarm only._
-**registry_auth ²** - Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
+**registry_auth**²: Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
-**registry_host** - To run `docker login` on another registry. Example: `ghcr.io`.
+**registry_host**: To run `docker login` on another registry. Example: `ghcr.io`.
-**registry_user/registry_pass** - Required to run `docker login` before stack deploy.
+**registry_user/registry_pass**: Required to run `docker login` before stack deploy.
-**summary** - Write a Summary for the job. To disable this set to `false`.
+**summary**: Write a Summary for the job. To disable this set to `false`.
To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
From 1feb38cde63a5419fcfe7ce8efe790fa96c62b9f Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 20:59:15 -0700
Subject: [PATCH 44/48] Update README.md
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 60b813a..1f753a0 100644
--- a/README.md
+++ b/README.md
@@ -82,9 +82,9 @@ fi
**name**: Stack name for Swarm and project name for Compose.
-**mode**¹: Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
+**mode**: **¹** Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
-**args**¹: Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
+**args**: **¹** Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
Use an empty string to override. For more details, see the compose up
[docs](https://docs.docker.com/reference/cli/docker/compose/up/). _Compose only._
@@ -99,13 +99,13 @@ To use a docker `env_file` specify it in your compose file and make it available
If you need compose file templating this can also be done in a previous step.
If using `mode: compose` you can also add the `compose_arg: --env-file stringArray`.
-**detach**²: Set this to `false` to not exit immediately and wait for the services to converge.
+**detach**: **²** Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
Defaults to `false` in `mode: compose`. _Swarm only._
-**resolve_image**²: When the default `always` is used, this argument is omitted. _Swarm only._
+**resolve_image**: **²** When the default `always` is used, this argument is omitted. _Swarm only._
-**registry_auth**²: Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
+**registry_auth**: **²** Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
**registry_host**: To run `docker login` on another registry. Example: `ghcr.io`.
From 35498a8576dcd2c87ad175927be50de3c59aba36 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 21:01:27 -0700
Subject: [PATCH 45/48] Update README.md
---
README.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 1f753a0..c64b600 100644
--- a/README.md
+++ b/README.md
@@ -82,12 +82,12 @@ fi
**name**: Stack name for Swarm and project name for Compose.
-**mode**: **¹** Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts. _Compose only._
+**mode**: _Compose only._ Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts.
-**args**: **¹** Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
+**args**: _Compose only._ Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
Use an empty string to override. For more details, see the compose up
-[docs](https://docs.docker.com/reference/cli/docker/compose/up/). _Compose only._
+[docs](https://docs.docker.com/reference/cli/docker/compose/up/).
**host**: The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
@@ -99,13 +99,13 @@ To use a docker `env_file` specify it in your compose file and make it available
If you need compose file templating this can also be done in a previous step.
If using `mode: compose` you can also add the `compose_arg: --env-file stringArray`.
-**detach**: **²** Set this to `false` to not exit immediately and wait for the services to converge.
+**detach**: _Swarm only._ Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
-Defaults to `false` in `mode: compose`. _Swarm only._
+Defaults to `false` in `mode: compose`.
-**resolve_image**: **²** When the default `always` is used, this argument is omitted. _Swarm only._
+**resolve_image**: _Swarm only._ When the default `always` is used, this argument is omitted.
-**registry_auth**: **²** Set to `true` to deploy with `--with-registry-auth`. _Swarm only._
+**registry_auth**: _Swarm only._ Set to `true` to deploy with `--with-registry-auth`.
**registry_host**: To run `docker login` on another registry. Example: `ghcr.io`.
From 2fe6f1310b4b9b0606e6387874ceb6eb0fe1062b Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 21:07:36 -0700
Subject: [PATCH 46/48] Update README.md
---
README.md | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index c64b600..c987774 100644
--- a/README.md
+++ b/README.md
@@ -62,8 +62,8 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| `registry_pass` | - | - | Registry Authentication Password \* |
| `summary` | - | `true` | Add Job Summary \* |
-> **¹** Compose Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/compose/up/).
-> **²** Swarm Only. View the [Documentation](https://docs.docker.com/reference/cli/docker/stack/deploy/).
+> **¹** Compose Only. View the [Docs](https://docs.docker.com/reference/cli/docker/compose/up/).
+> **²** Swarm Only. View the [Docs](https://docs.docker.com/reference/cli/docker/stack/deploy/).
> \* See Below for more details...
📟 Click Here to see how the deployment command is generated
@@ -80,38 +80,38 @@ fi
-**name**: Stack name for Swarm and project name for Compose.
+**name:** Stack name for Swarm and project name for Compose.
-**mode**: _Compose only._ Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts.
+**mode:** _Compose only._ Set this to `compose` to use `compose up` instead of `stack deploy` for non-swarm hosts.
-**args**: _Compose only._ Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
+**args:** _Compose only._ Compose arguments to pass to the `compose up` command. Only used for `mode: compose` deployments.
The `detach` flag defaults to false for compose. With no args the default is `--remove-orphans --force-recreate`.
-Use an empty string to override. For more details, see the compose up
+Use an empty string to override. For more details, see the compose
[docs](https://docs.docker.com/reference/cli/docker/compose/up/).
-**host**: The hostname or IP address of the remote docker server to deploy too.
+**host:** The hostname or IP address of the remote docker server to deploy too.
If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
-**pass/ssh_key**: You must provide either a `pass` or `ssh_key`, but not both.
+**pass/ssh_key:** You must provide either a `pass` or `ssh_key`, but not both.
-**env_file**: Variables in this file are exported before running stack deploy.
+**env_file:** Variables in this file are exported before running stack deploy.
To use a docker `env_file` specify it in your compose file and make it available in a previous step.
If you need compose file templating this can also be done in a previous step.
If using `mode: compose` you can also add the `compose_arg: --env-file stringArray`.
-**detach**: _Swarm only._ Set this to `false` to not exit immediately and wait for the services to converge.
+**detach:** _Swarm only._ Set this to `false` to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
Defaults to `false` in `mode: compose`.
-**resolve_image**: _Swarm only._ When the default `always` is used, this argument is omitted.
+**resolve_image:** _Swarm only._ When the default `always` is used, this argument is omitted.
-**registry_auth**: _Swarm only._ Set to `true` to deploy with `--with-registry-auth`.
+**registry_auth:** _Swarm only._ Set to `true` to deploy with `--with-registry-auth`.
-**registry_host**: To run `docker login` on another registry. Example: `ghcr.io`.
+**registry_host:** To run `docker login` on another registry. Example: `ghcr.io`.
-**registry_user/registry_pass**: Required to run `docker login` before stack deploy.
+**registry_user/registry_pass:** Required to run `docker login` before stack deploy.
-**summary**: Write a Summary for the job. To disable this set to `false`.
+**summary:** Write a Summary for the job. To disable this set to `false`.
To view a workflow run, click on a recent [Test](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml) job _(requires login)_.
From b1a8f8deb796d52cb3de4ee40613c1a23df4aab2 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 21:10:03 -0700
Subject: [PATCH 47/48] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index c987774..730e6e5 100644
--- a/README.md
+++ b/README.md
@@ -53,8 +53,8 @@ For more details see [action.yaml](action.yaml) and [src/main.sh](src/main.sh).
| `pass` | or `ssh_key` | - | Remote Docker Password \* |
| `ssh_key` | or `pass` | - | Remote SSH Key File \* |
| `env_file` | - | - | Docker Environment File \* |
-| `detach`**²** | - | `true` | Detach Flag, `false` to disable \* |
-| `prune`**²** | - | `false` | Prune Flag, `true` to enable |
+| `detach`**²** | - | `true` | Detach Flag, `false`, to disable \* |
+| `prune`**²** | - | `false` | Prune Flag, `true`, to enable |
| `resolve_image`**²** | - | `always` | Resolve [`always`, `changed`, `never`] \* |
| `registry_auth`**²** | - | - | Enable Registry Authentication \* |
| `registry_host` | - | - | Registry Authentication Host \* |
From 1d583b1ecb80364e9dbb6de495734e96c3c85a9d Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Thu, 13 Mar 2025 21:27:54 -0700
Subject: [PATCH 48/48] Update Release Workflow
---
.github/workflows/release.yaml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 9f47abb..379c315 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -14,4 +14,17 @@ jobs:
steps:
- name: "Update Tags"
+ id: tags
uses: cssnr/update-version-tags-action@v1
+
+ - name: "Debug Tags"
+ run: |
+ echo "github.ref_name: ${{ github.ref_name }}"
+ echo "steps.tags.outputs.tags: ${{ steps.tags.outputs.tags }}"
+
+ - name: "Update Release Notes Action"
+ uses: smashedr/update-release-notes-action@master
+ continue-on-error: true
+ with:
+ tags: "${{ steps.tags.outputs.tags }}"
+ location: tail