| 
									
										
										
										
											2021-05-28 13:24:09 +02:00
										 |  |  | #! /bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # To run with crontab:  | 
					
						
							| 
									
										
										
										
											2021-05-28 13:29:10 +02:00
										 |  |  | # */1 * * * * /home/pietervdvn/git/MapComplete/scripts/deployIfChanged.sh >> /home/pietervdvn/auto_deploy_caching.log 2>&1 | 
					
						
							| 
									
										
										
										
											2021-05-28 13:24:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-28 13:33:50 +02:00
										 |  |  | PATH=/home/pietervdvn/.local/bin:/home/pietervdvn/.nvm/versions/node/v16.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/pietervdvn/.dotnet/tools | 
					
						
							| 
									
										
										
										
											2021-05-28 13:24:09 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-28 13:29:10 +02:00
										 |  |  | cd ~/git/MapComplete | 
					
						
							| 
									
										
										
										
											2021-05-28 13:24:09 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |  git fetch | 
					
						
							|  |  |  |  HEADHASH=$(git rev-parse HEAD) | 
					
						
							|  |  |  |  UPSTREAMHASH=$(git rev-parse master@{upstream}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  if [ "$HEADHASH" != "$UPSTREAMHASH" ] | 
					
						
							|  |  |  |  then | 
					
						
							| 
									
										
										
										
											2021-05-28 13:35:13 +02:00
										 |  |  |    echo Not up to date with origin. Deploying! | 
					
						
							| 
									
										
										
										
											2021-05-28 13:24:09 +02:00
										 |  |  |    git pull | 
					
						
							| 
									
										
										
										
											2021-05-28 13:43:27 +02:00
										 |  |  |    npm run generate:translations | 
					
						
							|  |  |  |    git commit -am "Sync translations" | 
					
						
							|  |  |  |    git push | 
					
						
							|  |  |  |    npm run generate:docs | 
					
						
							|  |  |  |    git commit -am "Autgenerate docs and taginfo files" | 
					
						
							|  |  |  |     | 
					
						
							| 
									
										
										
										
											2021-05-28 13:24:09 +02:00
										 |  |  |    npm run deploy:production | 
					
						
							|  |  |  |  fi |