-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (74 loc) · 2.25 KB
/
deploy-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Deploy (dev)
on:
workflow_call:
inputs:
input-artifact:
required: true
type: string
output-artifact:
required: true
type: string
build-dockerfile:
required: true
type: string
version:
required: true
type: string
secrets:
SSH_PRIVATE_KEY_DEV:
required: true
REMOTE_HOST_DEV:
required: true
REMOTE_USER_DEV:
required: true
env:
CARGO_TERM_COLOR: always
jobs:
package:
name: Package ${{ inputs.output-artifact }} ${{ inputs.version }}
runs-on: ubuntu-latest
env:
PACKAGE_VERSION: ${{ inputs.version }}
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
with:
name: ${{ inputs.input-artifact }} # qwer-build-artifacts
path: ./rpmbuild/SOURCES
- name: Build RPM docker image
run: docker build -t build-container -f ${{ inputs.build-dockerfile }} . # build/Dockerfile.qwer .
- name: Run RPM docker environment
run: docker run --rm -v $(pwd):/app -e PACKAGE_VERSION="${{ inputs.version }}" build-container --entrypoint=/bin/bash
- uses: actions/upload-artifact@master
with:
name: ${{ inputs.output-artifact }} # qwer-rpm
path: ./rpmbuild/RPMS
deploy:
name: Deploy
needs: package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
with:
name: ${{ inputs.output-artifact }} # qwer-rpm
path: ./artifacts/
- name: Deploy
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_DEV }}
ARGS: >-
-rtzv
REMOTE_HOST: ${{ secrets.REMOTE_HOST_DEV }}
REMOTE_USER: ${{ secrets.REMOTE_USER_DEV }}
SOURCE: "artifacts/x86_64/"
TARGET: /home/${{ secrets.REMOTE_USER_DEV }}/${{ inputs.output-artifact }}
- name: Post Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST_DEV }}
username: ${{ secrets.REMOTE_USER_DEV }}
key: ${{ secrets.SSH_PRIVATE_KEY_DEV }}
port: 22
script: |
sudo /home/${{ secrets.REMOTE_USER_DEV }}/${{ inputs.output-artifact }}.sh