diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8494f9c..58d418c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/Dockerfile b/Dockerfile index 6cd936d..ffdb73d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 783d892..425658d 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/action.yml b/action.yml index 65891e8..3cdc797 100644 --- a/action.yml +++ b/action.yml @@ -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