Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Merge pull request #76 from danieldegroot2/tile-url #46

Merge pull request #76 from danieldegroot2/tile-url

Merge pull request #76 from danieldegroot2/tile-url #46

# deploy main branch
name: deploy-to-prod
on:
push:
branches:
- main
paths-ignore:
- README.md
- .gitignore
- LICENSE
- aed_poland.*
- aed_poland_metadata.json
jobs:
deploy:
name: Deploy to prod env
runs-on: ubuntu-latest
environment: prod
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/
git pull
rm -rf /home/${{ secrets.SSH_USER }}/temp_deploy_prod/
mkdir /home/${{ secrets.SSH_USER }}/temp_deploy_prod/
rsync --recursive \
--quiet /home/${{ secrets.SSH_USER }}/aed-mapa/web/ /home/${{ secrets.SSH_USER }}/temp_deploy_prod/
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_prod/js/osm-integration.js
sed -i "s|https://aed.openstreetmap.org.pl/dev/|https://aed.openstreetmap.org.pl/|g" /home/${{ secrets.SSH_USER }}/temp_deploy_prod/map_style/style.json
sed -i "s|https://aed.openstreetmap.org.pl/dev/|https://aed.openstreetmap.org.pl/|g" /home/${{ secrets.SSH_USER }}/temp_deploy_prod/js/map.js
rsync --update --recursive --delete \
--exclude '*.geojson' --exclude 'aed_poland_metadata.json' --exclude '*.ods' --exclude '*.csv' \
--verbose /home/${{ secrets.SSH_USER }}/temp_deploy_prod/ /var/www/html/
rm -rf /home/${{ secrets.SSH_USER }}/temp_deploy_prod/
EOF