forked from MapComplete/MapComplete
		
	Small tweaks to the deploy scripts
This commit is contained in:
		
							parent
							
								
									4e1fc46ff2
								
							
						
					
					
						commit
						a8aaf4b219
					
				
					 10 changed files with 65 additions and 19 deletions
				
			
		
							
								
								
									
										16
									
								
								.github/workflows/pull_request_check.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/pull_request_check.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | name: Pull request check | ||||||
|  | on: | ||||||
|  |   pull_request: | ||||||
|  |     types: [opened, edited, synchronize, ready_for_review, review_requested] | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   build: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v2 | ||||||
|  |       - name: Compile license info | ||||||
|  |         run: npm run generate:licenses | ||||||
|  |       | ||||||
|  |       - name: Compile and validate themes and layers | ||||||
|  |         run: npm run generate:layeroverview | ||||||
|  | 
 | ||||||
							
								
								
									
										17
									
								
								.github/workflows/theme_validation.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/theme_validation.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | ||||||
|  | name: Theme Validation | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |       - develop | ||||||
|  |       - master | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   build: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v2 | ||||||
|  |       - name: Compile license info | ||||||
|  |         run: npm run generate:licenses | ||||||
|  |       | ||||||
|  |       - name: Compile and validate themes and layers | ||||||
|  |         run: npm run generate:layeroverview | ||||||
|  | @ -2,7 +2,7 @@ import LayoutConfig from "./JSON/LayoutConfig"; | ||||||
| import AllKnownLayers from "./AllKnownLayers"; | import AllKnownLayers from "./AllKnownLayers"; | ||||||
| import * as known_themes from "../assets/generated/known_layers_and_themes.json" | import * as known_themes from "../assets/generated/known_layers_and_themes.json" | ||||||
| import {LayoutConfigJson} from "./JSON/LayoutConfigJson"; | import {LayoutConfigJson} from "./JSON/LayoutConfigJson"; | ||||||
| 
 | import * as all_layouts from "../assets/generated/known_layers_and_themes.json" | ||||||
| export class AllKnownLayouts { | export class AllKnownLayouts { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ import { Utils } from "../Utils"; | ||||||
| 
 | 
 | ||||||
| export default class Constants { | export default class Constants { | ||||||
|      |      | ||||||
|     public static vNumber = "0.6.6a"; |     public static vNumber = "0.6.7"; | ||||||
| 
 | 
 | ||||||
|     // The user journey states thresholds when a new feature gets unlocked
 |     // The user journey states thresholds when a new feature gets unlocked
 | ||||||
|     public static userJourney = { |     public static userJourney = { | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								Svg.ts
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								Svg.ts
									
										
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -15,10 +15,10 @@ | ||||||
|     "generate:translations": "ts-node scripts/generateTranslations.ts", |     "generate:translations": "ts-node scripts/generateTranslations.ts", | ||||||
|     "generate:layouts": "ts-node scripts/generateLayouts.ts", |     "generate:layouts": "ts-node scripts/generateLayouts.ts", | ||||||
|     "generate:docs": "ts-node scripts/generateDocs.ts", |     "generate:docs": "ts-node scripts/generateDocs.ts", | ||||||
|     "generate:layeroverview": "ts-node scripts/generateLayerOverview.ts", |     "generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail", | ||||||
|     "generate:licenses": "ts-node scripts/generateLicenseInfo.ts", |     "generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail", | ||||||
|     "optimize-images": "cd assets/generated/ &&  find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'", |     "optimize-images": "cd assets/generated/ &&  find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'", | ||||||
|     "generate": "npm run generate:images && npm run generate:translations", |     "generate": "npm run generate:images && npm run generate:translations && npm run generate:licenses", | ||||||
|     "build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*", |     "build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*", | ||||||
|     "prepare-deploy": "npm run test && npm run generate:editor-layer-index && npm run generate:layouts && npm run generate:layeroverview && npm run generate && npm run build && rm -rf .cache && npm run generate:docs", |     "prepare-deploy": "npm run test && npm run generate:editor-layer-index && npm run generate:layouts && npm run generate:layeroverview && npm run generate && npm run build && rm -rf .cache && npm run generate:docs", | ||||||
|     "deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", |     "deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", | ||||||
|  |  | ||||||
|  | @ -9,6 +9,10 @@ function genImages() { | ||||||
|     const allNames: string[] = []; |     const allNames: string[] = []; | ||||||
|     for (const path of dir) { |     for (const path of dir) { | ||||||
| 
 | 
 | ||||||
|  |         if(path.endsWith("license_info.json")){ | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|  |          | ||||||
|         if (!path.endsWith(".svg")) { |         if (!path.endsWith(".svg")) { | ||||||
|             throw "Non-svg file detected in the svg files: " + path; |             throw "Non-svg file detected in the svg files: " + path; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -117,5 +117,9 @@ if (layerErrorCount + themeErrorCount == 0) { | ||||||
|     console.log("All good!") |     console.log("All good!") | ||||||
| } else { | } else { | ||||||
|     const msg = (`Found ${layerErrorCount} errors in the layers; ${themeErrorCount} errors in the themes`) |     const msg = (`Found ${layerErrorCount} errors in the layers; ${themeErrorCount} errors in the themes`) | ||||||
|     throw msg; |     if(process.argv.indexOf("--no-fail") >= 0){ | ||||||
|  |         console.log(msg) | ||||||
|  |     }else{ | ||||||
|  |         throw msg; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,13 +3,13 @@ import {Utils} from "../Utils"; | ||||||
| Utils.runningFromConsole = true; | Utils.runningFromConsole = true; | ||||||
| 
 | 
 | ||||||
| import LayoutConfig from "../Customizations/JSON/LayoutConfig"; | import LayoutConfig from "../Customizations/JSON/LayoutConfig"; | ||||||
| import {AllKnownLayouts} from "../Customizations/AllKnownLayouts"; |  | ||||||
| import {existsSync, mkdirSync, readFileSync, writeFile, writeFileSync} from "fs"; | import {existsSync, mkdirSync, readFileSync, writeFile, writeFileSync} from "fs"; | ||||||
| import Locale from "../UI/i18n/Locale"; | import Locale from "../UI/i18n/Locale"; | ||||||
| import Translations from "../UI/i18n/Translations"; | import Translations from "../UI/i18n/Translations"; | ||||||
| import {Translation} from "../UI/i18n/Translation"; | import {Translation} from "../UI/i18n/Translation"; | ||||||
| import Constants from "../Models/Constants"; | import Constants from "../Models/Constants"; | ||||||
| 
 | import * as all_known_layouts from "../assets/generated/known_layers_and_themes.json" | ||||||
|  | import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson"; | ||||||
| const sharp = require('sharp'); | const sharp = require('sharp'); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -234,9 +234,12 @@ if (!existsSync(generatedDir)) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap", "custom"] | const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap", "custom"] | ||||||
| const all = AllKnownLayouts.allKnownLayouts; | const all : LayoutConfigJson[] = all_known_layouts.themes; | ||||||
| 
 | 
 | ||||||
| for (const layoutName in all) { | for (const i in all) { | ||||||
|  |     const layoutConfigJson : LayoutConfigJson = all[i] | ||||||
|  |     const layout = new LayoutConfig(layoutConfigJson, true, "generating layouts") | ||||||
|  |     const layoutName = layout.id | ||||||
|     if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) { |     if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) { | ||||||
|         console.log(`Skipping a layout with name${layoutName}, it is on the blacklist`); |         console.log(`Skipping a layout with name${layoutName}, it is on the blacklist`); | ||||||
|         continue; |         continue; | ||||||
|  | @ -246,7 +249,6 @@ for (const layoutName in all) { | ||||||
|             console.log("Could not write manifest for ", layoutName, " because ", err) |             console.log("Could not write manifest for ", layoutName, " because ", err) | ||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
|     const layout = all[layoutName]; |  | ||||||
|     validate(layout) |     validate(layout) | ||||||
|     createManifest(layout, "").then(manifObj => { |     createManifest(layout, "").then(manifObj => { | ||||||
|         const manif = JSON.stringify(manifObj, undefined, 2); |         const manif = JSON.stringify(manifObj, undefined, 2); | ||||||
|  |  | ||||||
|  | @ -182,16 +182,19 @@ writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfo | ||||||
| const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null) | const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null) | ||||||
| const missingLicenses = missingLicenseInfos(licenseInfos, artwork) | const missingLicenses = missingLicenseInfos(licenseInfos, artwork) | ||||||
| 
 | 
 | ||||||
| cleanLicenseInfo(licensePaths, licenseInfos) |  | ||||||
| 
 | 
 | ||||||
| if(missingLicenses.length > 0){ | if(missingLicenses.length > 0){ | ||||||
|     const msg = `There are ${missingLicenses.length} licenses missing.` |     const msg = `There are ${missingLicenses.length} licenses missing.` | ||||||
|     /* |     if(process.argv.indexOf("--no-fail") >= 0){ | ||||||
|     console.log(msg) |         console.log(msg) | ||||||
|     /*/ |     }else{ | ||||||
|     throw msg | 
 | ||||||
|      //*/
 |         throw msg | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // queryMissingLicenses(missingLicenses)
 | if(process.argv.indexOf("--prompt") >= 0) { | ||||||
|  |     queryMissingLicenses(missingLicenses) | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
|  | cleanLicenseInfo(licensePaths, licenseInfos) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue