This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
49 lines (46 loc) · 2 KB
/
deploy_to_dev.yaml
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
# deploy development branch
name: deploy-to-dev
on:
push:
branches:
- development
paths-ignore:
- README.md
- .gitignore
- LICENSE
- aed_poland.*
- aed_poland_metadata.json
jobs:
deploy:
name: Deploy to dev env
runs-on: ubuntu-latest
environment: dev
steps:
- name: Install SSH Key
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: ${{ secrets.SSH_HOST_IP }}
ssh-port: ${{ secrets.SSH_HOST_PORT }}
- name: Run deploy script on host
env:
OAUTH_CONSUMER_KEY: ${{ secrets.OAUTH_CONSUMER_KEY }}
OAUTH_SECRET: ${{ secrets.OAUTH_SECRET }}
OSM_API_URL: ${{ secrets.URL }}
run: |
ssh -t -p ${{ secrets.SSH_HOST_PORT }} -l ${{ secrets.SSH_USER }} ${{ secrets.SSH_HOST_IP }} << EOF
set -e
cd /home/${{ secrets.SSH_USER }}/aed-mapa-dev/
git pull
cp /home/${{ secrets.SSH_USER }}/aed-mapa-dev/scripts/update_pbf.sh /home/aeduser/update_pbf.sh
cp /home/${{ secrets.SSH_USER }}/aed-mapa-dev/scripts/download_dev.sh /home/aeduser/download_dev.sh
rm -rf /home/${{ secrets.SSH_USER }}/temp_deploy_dev/
mkdir /home/${{ secrets.SSH_USER }}/temp_deploy_dev/
rsync --recursive \
--quiet /home/${{ secrets.SSH_USER }}/aed-mapa-dev/web/ /home/${{ secrets.SSH_USER }}/temp_deploy_dev/
sed -i "s/<< oauth_consumer_key >>/$OAUTH_CONSUMER_KEY/;s/<< oauth_secret >>/$OAUTH_SECRET/;s|<< url >>|$OSM_API_URL|" /home/${{ secrets.SSH_USER }}/temp_deploy_dev/js/osm-integration.js
rsync --update --recursive --delete \
--exclude '*.geojson' --exclude 'aed_poland_metadata.json' --exclude '*.ods' --exclude '*.csv' \
--verbose /home/${{ secrets.SSH_USER }}/temp_deploy_dev/ /var/www/dev/
rm -rf /home/${{ secrets.SSH_USER }}/temp_deploy_dev/
EOF