Commit ae9f77df authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

ci: refine deployment script

parent 35a2a037
...@@ -11,6 +11,24 @@ ...@@ -11,6 +11,24 @@
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
.deloyment: &deploy
# set entry point for develop
- sed -i "s ahikar.*\.sub $SERVER.sub g" tido/dist/index.html
# arabic-karshuni
## remove old version
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/$TARGET/frontend/arabic-karshuni/*"
## upload new version
- scp -o 'StrictHostKeyChecking no' -r tido/dist/* $SSH_USER@$SSH_IP:~/$TARGET/frontend/arabic-karshuni/
# syriac
## remove old version
- sed -i 's textapi/ahikar/arabic-karshuni textapi /ahikar/syriac/' tido/dist/index.html
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/$TARGET/frontend/syriac/*"
## upload new version
- scp -o 'StrictHostKeyChecking no' -r tido/dist/* $SSH_USER@$SSH_IP:~/$TARGET/frontend/syriac/
# upload css
- scp -o 'StrictHostKeyChecking no' ahikar.css $SSH_USER@$SSH_IP:~/$TARGET/frontend/
## GLOBAL VARIABLES ## GLOBAL VARIABLES
variables: variables:
# ↓ needed to handle concurrency # ↓ needed to handle concurrency
...@@ -61,57 +79,36 @@ build: ...@@ -61,57 +79,36 @@ build:
- ahikar.css - ahikar.css
update_backend-test:
stage: update-backend
image: rsamban/scp-resource:latest
variables:
TARGET="test"
SERVER="ahikar-test"
script:
- *ssh
- *deploy
update_backend-develop: update_backend-develop:
stage: update-backend stage: update-backend
image: rsamban/scp-resource:latest image: rsamban/scp-resource:latest
only: only:
- develop - develop
variables:
TARGET="develop"
SERVER="ahikar-dev"
script: script:
- *ssh - *ssh
# set entry point for develop - *deploy
- sed -i "s ahikar.*\.sub ahikar-dev.sub g" tido/dist/index.html
# arabic-karshuni
## remove old version
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/$CI_COMMIT_REF_NAME/frontend/arabic-karshuni/*"
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/test/frontend/arabic-karshuni/*"
## upload new version
- scp -o 'StrictHostKeyChecking no' -r tido/dist/* $SSH_USER@$SSH_IP:~/$CI_COMMIT_REF_NAME/frontend/arabic-karshuni/
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "cp -r ~/$CI_COMMIT_REF_NAME/frontend/arabic-karshuni/* ~/test/frontend/arabic-karshuni/"
## set entry point for test
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "sed -i 's ahikar-dev.*\.sub ahikar-test.sub g' ~/test/frontend/arabic-karshuni/index.html"
# syriac
## remove old version
- sed -i 's/textapi\/ahikar\/arabic-karshuni/textapi\/ahikar\/syriac/' tido/dist/index.html
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/$CI_COMMIT_REF_NAME/frontend/syriac/*"
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/test/frontend/syriac/*"
## upload new version
- scp -o 'StrictHostKeyChecking no' -r tido/dist/* $SSH_USER@$SSH_IP:~/$CI_COMMIT_REF_NAME/frontend/syriac/
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "cp -r ~/$CI_COMMIT_REF_NAME/frontend/arabic-karshuni/* ~/test/frontend/syriac/"
## set entry point for test
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "sed -i 's ahikar-dev.*\.sub ahikar-test.sub g' ~/test/frontend/syriac/index.html"
# upload css
- scp -o 'StrictHostKeyChecking no' ahikar.css $SSH_USER@$SSH_IP:~/$CI_COMMIT_REF_NAME/frontend/
- scp -o 'StrictHostKeyChecking no' ahikar.css $SSH_USER@$SSH_IP:~/test/frontend/
update_backend-main: update_backend-main:
stage: update-backend stage: update-backend
image: rsamban/scp-resource:latest image: rsamban/scp-resource:latest
only: only:
- main - main
variables:
TARGET="main"
SERVER="ahikar"
script: script:
- *ssh - *ssh
- sed -i "s ahikar.*\.sub ahikar.sub g" tido/dist/index.html - *deploy
# arabic-karshuni \ No newline at end of file
## remove old version
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/$CI_COMMIT_REF_NAME/frontend/arabic-karshuni/*"
## upload new version
- scp -o 'StrictHostKeyChecking no' -r tido/dist/* $SSH_USER@$SSH_IP:~/$CI_COMMIT_REF_NAME/frontend/arabic-karshuni/
# syriac
## remove old version
- sed -i 's/textapi\/ahikar\/arabic-karshuni/textapi\/ahikar\/syriac/' tido/dist/index.html
- ssh -o 'StrictHostKeyChecking no' $SSH_USER@$SSH_IP "rm -rf ~/$CI_COMMIT_REF_NAME/frontend/syriac/*"
## upload new version
- scp -o 'StrictHostKeyChecking no' -r tido/dist/* $SSH_USER@$SSH_IP:~/$CI_COMMIT_REF_NAME/frontend/syriac/
# upload css
- scp -o 'StrictHostKeyChecking no' ahikar.css $SSH_USER@$SSH_IP:~/$CI_COMMIT_REF_NAME/frontend/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment