Skip to content

Commit 46dd8c8

Browse files
committed
Update Workflows
1 parent cbaee9c commit 46dd8c8

File tree

4 files changed

+55
-14
lines changed

4 files changed

+55
-14
lines changed

.github/workflows/release.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Release"
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
name: "Release"
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: "Update Tags"
17+
uses: cssnr/update-version-tags-action@v1

.github/workflows/tags.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: "Tags"
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Target Tag"
8+
required: true
69

710
jobs:
811
tags:
@@ -15,3 +18,6 @@ jobs:
1518
steps:
1619
- name: "Update Tags"
1720
uses: cssnr/update-version-tags-action@v1
21+
with:
22+
tag: ${{ inputs.tag }}
23+
token: ${{ secrets.GH_PAT }}

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Tags](https://img.shields.io/github/actions/workflow/status/cssnr/stack-deploy-action/tags.yaml?logo=github&logoColor=white&label=tags)](https://github.com/cssnr/stack-deploy-action/actions/workflows/tags.yaml)
1+
[![Release](https://img.shields.io/github/actions/workflow/status/cssnr/stack-deploy-action/release.yaml?logo=github&logoColor=white&label=release)](https://github.com/cssnr/stack-deploy-action/actions/workflows/release.yaml)
22
[![Test](https://img.shields.io/github/actions/workflow/status/cssnr/stack-deploy-action/test.yaml?logo=github&logoColor=white&label=test)](https://github.com/cssnr/stack-deploy-action/actions/workflows/test.yaml)
33
[![Lint](https://img.shields.io/github/actions/workflow/status/cssnr/stack-deploy-action/lint.yaml?logo=github&logoColor=white&label=lint)](https://github.com/cssnr/stack-deploy-action/actions/workflows/lint.yaml)
44
[![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/stack-deploy-action?logo=github)](https://github.com/cssnr/stack-deploy-action/releases/latest)
@@ -39,7 +39,7 @@ _Portainer Users_: You can deploy directly to Portainer with: [cssnr/portainer-s
3939
| registry_host | - | - | Registry Authentication Host \* |
4040
| registry_user | - | - | Registry Authentication User \* |
4141
| registry_pass | - | - | Registry Authentication Pass \* |
42-
| summary | - | `true` | Add Job Summary |
42+
| summary | - | `true` | Add Job Summary \* |
4343

4444
**pass/ssh_key** - You must provide either a `pass` or `ssh_key`
4545

@@ -49,8 +49,24 @@ _Portainer Users_: You can deploy directly to Portainer with: [cssnr/portainer-s
4949

5050
**registry_user/registry_pass** - Required to run `docker login` before stack deploy
5151

52+
**summary** - Write a Summary for the job. To disable this set to `false`.
53+
54+
<details><summary>📜 View Example Job Summary</summary>
55+
56+
---
57+
58+
🎉 Stack `test-stack` Successfully Deployed.
59+
60+
```text
61+
Updating service test-stack_alpine (id: tu58yhd2vpbr0uymimvy2fq4i)
62+
```
63+
64+
---
65+
66+
</details>
67+
5268
```yaml
53-
- name: 'Docker Stack Deploy'
69+
- name: 'Stack Deploy Action'
5470
uses: cssnr/stack-deploy-action@v1
5571
with:
5672
name: 'stack-name'
@@ -64,7 +80,7 @@ _Portainer Users_: You can deploy directly to Portainer with: [cssnr/portainer-s
6480
Use `docker login` and enable `--with-registry-auth`
6581

6682
```yaml
67-
- name: 'Docker Stack Deploy'
83+
- name: 'Stack Deploy Action'
6884
uses: cssnr/stack-deploy-action@v1
6985
with:
7086
name: 'stack-name'
@@ -83,7 +99,7 @@ Use `docker login` and enable `--with-registry-auth`
8399
Simple Example
84100

85101
```yaml
86-
name: 'Test Docker Stack Deploy'
102+
name: 'Docker Stack Deploy'
87103
88104
on:
89105
push:
@@ -98,7 +114,7 @@ jobs:
98114
- name: 'Checkout'
99115
uses: actions/checkout@v4
100116
101-
- name: 'Docker Stack Deploy'
117+
- name: 'Stack Deploy Action'
102118
uses: cssnr/stack-deploy-action@v1
103119
with:
104120
name: 'stack-name'
@@ -112,7 +128,7 @@ jobs:
112128
Full Example
113129

114130
```yaml
115-
name: 'Test Docker Stack Deploy'
131+
name: 'Docker Stack Deploy'
116132
117133
on:
118134
workflow_dispatch:
@@ -162,7 +178,7 @@ jobs:
162178
push: true
163179
tags: ${{ steps.tags.outputs.tags }}
164180
165-
- name: 'Docker Stack Deploy'
181+
- name: 'Stack Deploy Action'
166182
uses: cssnr/stack-deploy-action@v1
167183
with:
168184
name: 'stack-name'

src/main.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> /root/.ssh/known_hosts
2929
echo "::endgroup::"
3030

3131
if [ -z "${INPUT_SSH_KEY}" ];then
32-
echo -e "::group::Copying SSH Key to: \u001b[36;1m${INPUT_HOST}"
32+
echo -e "::group::Copying SSH Key to Remote Host"
3333
ssh-keygen -q -f /root/.ssh/id_rsa -N "" -C "docker-stack-deploy-action"
3434
eval "$(ssh-agent -s)"
3535
ssh-add /root/.ssh/id_rsa
@@ -48,7 +48,7 @@ echo "::endgroup::"
4848

4949
trap cleanup_trap EXIT HUP INT QUIT PIPE TERM
5050

51-
echo "::group::Verifying Docker and Setting Context."
51+
echo "::group::Verifying Remote Docker Context"
5252
ssh -o BatchMode=yes -o ConnectTimeout=15 -p "${INPUT_PORT}" \
5353
"${INPUT_USER}@${INPUT_HOST}" "docker info" > /dev/null
5454
if ! docker context inspect remote >/dev/null 2>&1;then
@@ -75,14 +75,16 @@ if [[ -n "${INPUT_REGISTRY_USER}" && -n "${INPUT_REGISTRY_PASS}" ]];then
7575
echo "::endgroup::"
7676
fi
7777

78-
echo -e "Deploying Stack: \u001b[36;1m${INPUT_NAME}"
78+
echo -e "::group::Deploying Stack: \u001b[36;1m${INPUT_NAME}"
7979
EXTRA_ARGS=()
8080
if [[ -n "${INPUT_REGISTRY_AUTH}" ]];then
81-
echo -e "Enabling Registry Authentication"
81+
echo -e "Adding: --with-registry-auth"
8282
EXTRA_ARGS+=("--with-registry-auth")
8383
fi
8484
# shellcheck disable=SC2034
8585
STACK_RESULTS=$(docker stack deploy -c "${INPUT_FILE}" "${INPUT_NAME}" "${EXTRA_ARGS[@]}")
86+
echo "${STACK_RESULTS}"
87+
echo "::endgroup::"
8688

8789
if [[ "${INPUT_SUMMARY}" == "true" ]];then
8890
echo "📝 Writing Job Summary"

0 commit comments

Comments
 (0)