test.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
name: LS

...

jobs:
deploy:
runs-on: ubuntu-latest

steps:

- name: Update and restart server
uses: appleboy/ssh-action@v0.1.4
with:
host: ${{ secrets[format('{0}_HOST', github.workflow)] }}
username: ${{ secrets[format('{0}_USER', github.workflow)] }}

比如workflow的名称为LS, 密钥名称就为:

1
2
3
with:
host: ${{ secrets['LS_HOST'] }}
username: ${{ secrets['LS_USER'] }}