-
-
Notifications
You must be signed in to change notification settings - Fork 90
50 lines (39 loc) · 1.49 KB
/
build-deploy.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
name: Build and Deploy
on:
push:
branches:
- 'master'
- 'dev'
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') || !contains(github.event.head_commit.message, 'ci-push') }}
uses: ./.github/workflows/build.yml
secrets: inherit
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Install apt packages
run: sudo apt-get install -y unzip rsync
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: LSSM_V4-${{ github.sha }}
- name: Unzip artifact
run: |
unzip dist.zip -d ${{ github.workspace }}/dist
rm dist.zip
- name: list content of dist
if: ${{ github.ref == 'refs/heads/dev' }}
run: ls -la dist
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_DEPLOY_KEY }}
known_hosts: 'placeholder to avoid errors'
if_key_exists: replace
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deployment
if: ${{ success() }}
run: rsync -ruthz --stats --progress -e "ssh -p 22" ./dist/dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/${{ needs.build.outputs.type }}