Skip to content

Commit 334f925

Browse files
authored
chore: update action configuration for greater flexibility (#240)
- Update base image version from `1.6.12` to `1.6.13` in Dockerfile - Add `envs_format` input with flexible configuration in action.yml - Add a line to README.md pointing to action.yml for more information fix #213
1 parent 6268c80 commit 334f925

File tree

4 files changed

+65
-37
lines changed

4 files changed

+65
-37
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ env:
77

88
jobs:
99

10-
build:
11-
name: Build
10+
testing01:
11+
name: default flag testing
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: checkout
@@ -78,40 +78,6 @@ jobs:
7878
mkdir abc/def
7979
ls -al
8080
81-
- name: pass environment
82-
uses: ./
83-
env:
84-
FOO: "BAR"
85-
with:
86-
host: ${{ secrets.HOST }}
87-
username: ${{ secrets.USERNAME }}
88-
key: ${{ secrets.KEY }}
89-
port: ${{ secrets.PORT }}
90-
envs: FOO
91-
script: |
92-
echo "I am $FOO, thanks"
93-
echo "I am $BAR, thanks"
94-
95-
- name: pass multiple environment
96-
uses: ./
97-
env:
98-
FOO: "BAR"
99-
BAR: "FOO"
100-
SHA: ${{ github.sha }}
101-
PORT: ${{ secrets.PORT }}
102-
with:
103-
host: ${{ secrets.HOST }}
104-
username: ${{ secrets.USERNAME }}
105-
key: ${{ secrets.KEY }}
106-
port: ${{ secrets.PORT }}
107-
envs: FOO,BAR,SHA,PORT
108-
script: |
109-
echo "I am $FOO, thanks"
110-
echo "I am $BAR, thanks"
111-
echo "sha: $SHA"
112-
echo "port: $PORT"
113-
sh test.sh
114-
11581
- name: ssh key passphrase
11682
uses: ./
11783
with:
@@ -172,3 +138,62 @@ jobs:
172138
# key: ${{ secrets.ID_ED25519 }}
173139
# port: ${{ secrets.TUNNEL_PORT }}
174140
# script: whoami
141+
142+
testing02:
143+
name: testing with envs
144+
runs-on: ubuntu-latest
145+
steps:
146+
- name: checkout
147+
uses: actions/checkout@v1
148+
149+
- name: pass environment
150+
uses: ./
151+
env:
152+
FOO: "BAR"
153+
with:
154+
host: ${{ secrets.HOST }}
155+
username: ${{ secrets.USERNAME }}
156+
key: ${{ secrets.KEY }}
157+
port: ${{ secrets.PORT }}
158+
envs: FOO
159+
script: |
160+
echo "I am $FOO, thanks"
161+
echo "I am $BAR, thanks"
162+
163+
- name: pass multiple environment
164+
uses: ./
165+
env:
166+
FOO: "BAR"
167+
BAR: "FOO"
168+
SHA: ${{ github.sha }}
169+
PORT: ${{ secrets.PORT }}
170+
with:
171+
host: ${{ secrets.HOST }}
172+
username: ${{ secrets.USERNAME }}
173+
key: ${{ secrets.KEY }}
174+
port: ${{ secrets.PORT }}
175+
envs: FOO,BAR,SHA,PORT
176+
script: |
177+
echo "I am $FOO, thanks"
178+
echo "I am $BAR, thanks"
179+
echo "sha: $SHA"
180+
echo "port: $PORT"
181+
sh test.sh
182+
183+
- name: custom envs format
184+
uses: ./
185+
env:
186+
FOO: "BAR"
187+
AAA: "BBB"
188+
with:
189+
host: ${{ secrets.HOST }}
190+
username: ${{ secrets.USERNAME }}
191+
key: ${{ secrets.KEY }}
192+
port: ${{ secrets.PORT }}
193+
envs: FOO,BAR,AAA
194+
envs_format: export TEST_{NAME}={VALUE}
195+
script: |
196+
echo "I am $TEST_FOO, thanks"
197+
echo "I am $TEST_BAR, thanks"
198+
echo "I am $BAR, thanks"
199+
echo "I am $TEST_AAA, thanks"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/appleboy/drone-ssh:1.6.12
1+
FROM ghcr.io/appleboy/drone-ssh:1.6.13
22

33
COPY entrypoint.sh /entrypoint.sh
44
RUN chmod +x /entrypoint.sh

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ See [action.yml](./action.yml) for more detailed information.
3333
* `debug` - enable debug mode
3434
* `use_insecure_cipher` - include more ciphers with use_insecure_cipher (see [#56](https://github.com/appleboy/ssh-action/issues/56))
3535
* `cipher` - the allowed cipher algorithms. If unspecified then a sensible
36+
* `envs_format` - flexible configuration of environment value transfer. default is `export {NAME}={VALUE}`
3637

3738
SSH Proxy Setting:
3839

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ inputs:
6565
default: false
6666
envs:
6767
description: 'pass environment variable to shell script'
68+
envs_format:
69+
description: 'flexible configuration of environment value transfer'
6870
debug:
6971
description: 'enable debug mode'
7072
default: false

0 commit comments

Comments
 (0)