-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (33 loc) · 1.26 KB
/
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
name: Deploy Services
on:
workflow_dispatch:
jobs:
deploy-to-control-plane:
name: Run deploy script
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
set -xe;
GH_ACTION_POSITORY_URL=${{ github.repositoryUrl }}
TARGET_REPOSITORY_URL=${GH_ACTION_POSITORY_URL/git:/https:}
TARGET_REPOSITORY_BRANCH=${{ github.ref_name }}
LOCAL_REPOSITORY_PATH=/tmp/ladesa-ro/infra/repo
if [ ! -d ${LOCAL_REPOSITORY_PATH}/.git ]; then
rm -rf ${LOCAL_REPOSITORY_PATH};
git clone ${TARGET_REPOSITORY_URL} ${LOCAL_REPOSITORY_PATH};
fi
cd ${LOCAL_REPOSITORY_PATH};
git remote set-url origin ${TARGET_REPOSITORY_URL};
git fetch -p;
git reset --hard origin/${TARGET_REPOSITORY_BRANCH};
git restore .;
git clean -f -x;
export LADESA_DEPLOY_OPINATED_CONFIG_PATH=${{ secrets.LADESA_DEPLOY_OPINATED_CONFIG_PATH }}
./background-deploy.sh;