This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
Merge pull request #78 from RicoElectrico/development #170
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
# 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 |