Deploy Services #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |