2019-09-28 02:54:49 +00:00
|
|
|
name: scp files
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
2019-05-11 09:01:31 +00:00
|
|
|
|
2023-04-09 08:49:19 +00:00
|
|
|
testing:
|
|
|
|
name: test scp action
|
2019-09-28 02:54:49 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-02-13 16:49:23 +00:00
|
|
|
- name: checkout
|
2022-06-15 14:11:02 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-02-13 16:49:23 +00:00
|
|
|
|
2019-09-28 02:54:49 +00:00
|
|
|
- name: copy file via ssh password
|
2020-02-13 16:49:23 +00:00
|
|
|
uses: ./
|
2019-09-28 02:54:49 +00:00
|
|
|
with:
|
2019-09-28 04:13:03 +00:00
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-28 02:54:49 +00:00
|
|
|
source: "tests/a.txt,tests/b.txt"
|
2019-09-28 03:37:34 +00:00
|
|
|
target: "test"
|
2019-09-28 04:01:18 +00:00
|
|
|
|
|
|
|
- name: copy file via ssh key
|
2020-02-13 16:49:23 +00:00
|
|
|
uses: ./
|
2019-09-28 04:01:18 +00:00
|
|
|
with:
|
2019-09-28 04:16:21 +00:00
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-28 04:01:18 +00:00
|
|
|
source: "tests/a.txt,tests/b.txt"
|
|
|
|
target: "test"
|
2019-09-28 04:26:40 +00:00
|
|
|
|
|
|
|
- name: remove the specified number of leading path elements
|
2020-02-13 16:49:23 +00:00
|
|
|
uses: ./
|
2019-09-28 04:26:40 +00:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: "tests/a.txt,tests/b.txt"
|
|
|
|
target: "foobar"
|
|
|
|
strip_components: 1
|
2020-01-20 14:51:17 +00:00
|
|
|
|
|
|
|
- name: ssh key with passphrase
|
2020-02-13 16:49:23 +00:00
|
|
|
uses: ./
|
2020-01-20 14:51:17 +00:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.SSH2 }}
|
|
|
|
passphrase: ${{ secrets.PASSPHRASE }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: "tests/a.txt,tests/b.txt"
|
|
|
|
target: "test"
|
2020-05-24 06:24:45 +00:00
|
|
|
|
|
|
|
- name: use insecure cipher
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.SSH2 }}
|
|
|
|
passphrase: ${{ secrets.PASSPHRASE }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: "tests/a.txt,tests/b.txt"
|
|
|
|
target: "test"
|
|
|
|
use_insecure_cipher: true
|
2023-04-09 08:49:19 +00:00
|
|
|
|
2023-04-09 09:13:24 +00:00
|
|
|
- name: correct key but wrong password
|
|
|
|
uses: appleboy/scp-action@7af00892de6f8397c5c3393cfb3b32ae7f91b94b
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
password: abcdefg
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: "tests/a.txt,tests/b.txt"
|
|
|
|
target: "test"
|
|
|
|
|
|
|
|
- name: correct password but wrong key
|
|
|
|
uses: appleboy/scp-action@7af00892de6f8397c5c3393cfb3b32ae7f91b94b
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: abcdefg
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: "tests/a.txt,tests/b.txt"
|
|
|
|
target: "test"
|
|
|
|
|
2023-04-09 08:49:19 +00:00
|
|
|
deploy:
|
2023-04-15 00:32:05 +00:00
|
|
|
name: test deploy artifact
|
2023-04-09 08:49:19 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- run: echo hello > world.txt
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: my-artifact
|
|
|
|
path: world.txt
|
|
|
|
|
2023-04-11 03:05:43 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
2023-04-09 08:49:19 +00:00
|
|
|
with:
|
|
|
|
name: my-artifact
|
|
|
|
path: distfiles
|
|
|
|
|
|
|
|
- name: copy file to server
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: distfiles/*
|
|
|
|
target: test
|
2023-04-09 10:10:17 +00:00
|
|
|
|
|
|
|
changes:
|
|
|
|
name: test changed-files
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
|
|
|
uses: tj-actions/changed-files@v35
|
|
|
|
with:
|
|
|
|
since_last_remote_commit: true
|
|
|
|
separator: ","
|
|
|
|
|
|
|
|
- name: copy file to server
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: ${{ steps.changed-files.outputs.all_changed_files }}
|
|
|
|
target: test
|
2023-04-15 00:32:05 +00:00
|
|
|
|
|
|
|
target:
|
|
|
|
name: test target folder
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: copy file to server
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
source: tests/a.txt,tests/b.txt
|
|
|
|
target: test foobar
|