ci: add deployment workflow for artifact delivery (#103)
- Add a deployment job to the CI workflow - Upload `world.txt` as an artifact - Download the artifact to the `distfiles` directory - Add a step to copy files to a server using SSH fix https://github.com/appleboy/scp-action/issues/35
This commit is contained in:
parent
d47875703f
commit
c8e0cef94a
2 changed files with 64 additions and 2 deletions
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
|
@ -2,8 +2,8 @@ name: scp files
|
|||
on: [push]
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Build
|
||||
testing:
|
||||
name: test scp action
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
|
@ -62,3 +62,32 @@ jobs:
|
|||
source: "tests/a.txt,tests/b.txt"
|
||||
target: "test"
|
||||
use_insecure_cipher: true
|
||||
|
||||
deploy:
|
||||
name: deploy artifact
|
||||
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
|
||||
|
||||
- uses: actions/download-artifact@v2
|
||||
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
|
||||
|
|
33
README.md
33
README.md
|
@ -203,6 +203,39 @@ Example configuration for exclude custom files:
|
|||
target: "test"
|
||||
```
|
||||
|
||||
Upload artifact files to remote server:
|
||||
|
||||
```yaml
|
||||
deploy:
|
||||
name: deploy artifact
|
||||
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
|
||||
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: my-artifact
|
||||
path: distfiles
|
||||
|
||||
- name: copy file to server
|
||||
uses: appleboy/scp-action@master
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
key: ${{ secrets.KEY }}
|
||||
port: ${{ secrets.PORT }}
|
||||
source: distfiles/*
|
||||
target: test
|
||||
```
|
||||
|
||||
Remove the specified number of leading path elements:
|
||||
|
||||
```yaml
|
||||
|
|
Loading…
Reference in a new issue