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,8 +2,8 @@ name: scp files
|
||||||
on: [push]
|
on: [push]
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
testing:
|
||||||
name: Build
|
name: test scp action
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
|
@ -62,3 +62,32 @@ jobs:
|
||||||
source: "tests/a.txt,tests/b.txt"
|
source: "tests/a.txt,tests/b.txt"
|
||||||
target: "test"
|
target: "test"
|
||||||
use_insecure_cipher: true
|
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"
|
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:
|
Remove the specified number of leading path elements:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
Loading…
Reference in New Issue