-
-
Notifications
You must be signed in to change notification settings - Fork 90
55 lines (45 loc) · 2.32 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
50
51
52
53
54
55
name: Build and Deploy
on:
push:
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]
if: github.repository_owner == 'LSS-Manager' && !startsWith(github.ref, 'refs/heads/renovate/') && github.ref != 'chore/clean-update-yarnlock'
runs-on: ubuntu-latest
steps:
- name: Install apt packages
run: sudo apt-get install -y unzip rsync
- name: Download artifact
uses: actions/download-artifact@v3
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
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 }}:${{ secrets.DEPLOY_DIR }}/${{ needs.build.outputs.branch }}
- name: Create symlinks on server
if: ${{ success() }}
run: |
ssh -p 22 ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "
ln -sf ${{ secrets.DEPLOY_DIR }}/static/.check_request.php ${{ secrets.DEPLOY_DIR }}/${{ needs.build.outputs.branch }}/static/;
ln -sf ${{ secrets.DEPLOY_DIR }}/static/db_access.php ${{ secrets.DEPLOY_DIR }}/${{ needs.build.outputs.branch }}/static/;
ln -sf ${{ secrets.DEPLOY_DIR }}/static/missions ${{ secrets.DEPLOY_DIR }}/${{ needs.build.outputs.branch }}/static/;
ln -sf ${{ secrets.DEPLOY_DIR }}/static/releasenotes ${{ secrets.DEPLOY_DIR }}/${{ needs.build.outputs.branch }}/static/;
"