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 https://github.com/appleboy/ssh-action/issues/213
This commit is contained in:
Bo-Yi Wu 2023-04-13 11:15:42 +08:00 committed by GitHub
parent 6268c80dd6
commit 334f9259f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 37 deletions

View File

@ -7,8 +7,8 @@ env:
jobs:
build:
name: Build
testing01:
name: default flag testing
runs-on: ubuntu-latest
steps:
- name: checkout
@ -78,40 +78,6 @@ jobs:
mkdir abc/def
ls -al
- name: pass environment
uses: ./
env:
FOO: "BAR"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: FOO
script: |
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
- name: pass multiple environment
uses: ./
env:
FOO: "BAR"
BAR: "FOO"
SHA: ${{ github.sha }}
PORT: ${{ secrets.PORT }}
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: FOO,BAR,SHA,PORT
script: |
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
echo "sha: $SHA"
echo "port: $PORT"
sh test.sh
- name: ssh key passphrase
uses: ./
with:
@ -172,3 +138,62 @@ jobs:
# key: ${{ secrets.ID_ED25519 }}
# port: ${{ secrets.TUNNEL_PORT }}
# script: whoami
testing02:
name: testing with envs
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1
- name: pass environment
uses: ./
env:
FOO: "BAR"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: FOO
script: |
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
- name: pass multiple environment
uses: ./
env:
FOO: "BAR"
BAR: "FOO"
SHA: ${{ github.sha }}
PORT: ${{ secrets.PORT }}
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: FOO,BAR,SHA,PORT
script: |
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
echo "sha: $SHA"
echo "port: $PORT"
sh test.sh
- name: custom envs format
uses: ./
env:
FOO: "BAR"
AAA: "BBB"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: FOO,BAR,AAA
envs_format: export TEST_{NAME}={VALUE}
script: |
echo "I am $TEST_FOO, thanks"
echo "I am $TEST_BAR, thanks"
echo "I am $BAR, thanks"
echo "I am $TEST_AAA, thanks"

View File

@ -1,4 +1,4 @@
FROM ghcr.io/appleboy/drone-ssh:1.6.12
FROM ghcr.io/appleboy/drone-ssh:1.6.13
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

View File

@ -33,6 +33,7 @@ See [action.yml](./action.yml) for more detailed information.
* `debug` - enable debug mode
* `use_insecure_cipher` - include more ciphers with use_insecure_cipher (see [#56](https://github.com/appleboy/ssh-action/issues/56))
* `cipher` - the allowed cipher algorithms. If unspecified then a sensible
* `envs_format` - flexible configuration of environment value transfer. default is `export {NAME}={VALUE}`
SSH Proxy Setting:

View File

@ -65,6 +65,8 @@ inputs:
default: false
envs:
description: 'pass environment variable to shell script'
envs_format:
description: 'flexible configuration of environment value transfer'
debug:
description: 'enable debug mode'
default: false