| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | #!/usr/bin/env bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-18 20:20:38 +02:00
										 |  |  | export GITHUB_REPO=trilium | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | if [[ $# -eq 0 ]] ; then | 
					
						
							|  |  |  |     echo "Missing argument of new version" | 
					
						
							|  |  |  |     exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-14 21:12:51 +03:00
										 |  |  | if ! command -v jq &> /dev/null; then | 
					
						
							|  |  |  |   echo "Missing command: jq" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | VERSION=$1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ; | 
					
						
							|  |  |  | then | 
					
						
							|  |  |  |     echo "Version ${VERSION} isn't in format X.Y.Z" | 
					
						
							|  |  |  |     exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if ! git diff-index --quiet HEAD --; then | 
					
						
							|  |  |  |     echo "There are uncommitted changes" | 
					
						
							|  |  |  |     exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 21:05:08 -05:00
										 |  |  | echo "Releasing Trilium $VERSION" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-14 21:13:06 +03:00
										 |  |  | jq '.version = "'$VERSION'"' package.json > package.json.tmp | 
					
						
							|  |  |  | mv package.json.tmp package.json | 
					
						
							| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 21:06:35 -05:00
										 |  |  | git add package.json | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-21 11:45:31 +03:00
										 |  |  | npm run update-build-info | 
					
						
							| 
									
										
										
										
											2017-12-25 21:05:08 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-17 19:09:36 +02:00
										 |  |  | git add src/services/build.ts | 
					
						
							| 
									
										
										
										
											2017-12-25 21:06:35 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | TAG=v$VERSION | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 21:05:08 -05:00
										 |  |  | echo "Committing package.json version change" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | git commit -m "release $VERSION" | 
					
						
							| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | git push | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 21:05:08 -05:00
										 |  |  | echo "Tagging commit with $TAG" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-25 15:01:33 -05:00
										 |  |  | git tag $TAG | 
					
						
							|  |  |  | git push origin $TAG |