mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Extend release action to update website
This commit is contained in:
		
							
								
								
									
										18
									
								
								.github/scripts/update-node-red-website.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.github/scripts/update-node-red-website.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| const fs = require("fs"); | ||||
|  | ||||
| const newVersion = require("../../package.json").version; | ||||
|  | ||||
| if (process.env.GITHUB_REF !== "refs/tags/"+newVersion) { | ||||
|     console.log(`GITHUB_REF doesn't match the package.json version: ${process.env.GITHUB_REF} !== ${newVersion}`); | ||||
|     process.exit(0); | ||||
| } | ||||
|  | ||||
| if (!/^\d+\.\d+\.\d+$/.test(newVersion)) { | ||||
|     console.log(`Not updating for a non-stable release - ${newVersion}`); | ||||
|     process.exit(0); | ||||
| } | ||||
|  | ||||
| const path = __dirname+"/../../../node-red.github.io/index.html"; | ||||
| let contents = fs.readFileSync(path, "utf8"); | ||||
| contents = contents.replace(/<span class="node-red-latest-version">v\d+\.\d+\.\d+<\/span>/, `<span class="node-red-latest-version">v${newVersion}<\/span>` ); | ||||
| fs.writeFileSync(path, contents); | ||||
							
								
								
									
										22
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -18,12 +18,16 @@ jobs: | ||||
|         with: | ||||
|             repository: 'node-red/node-red-docker' | ||||
|             path: 'node-red-docker' | ||||
|       - name: Check out node-red.github.io repository | ||||
|         uses: actions/checkout@v2 | ||||
|         with: | ||||
|             repository: 'node-red/node-red.github.io' | ||||
|             path: 'node-red.github.io' | ||||
|       - uses: actions/setup-node@v1 | ||||
|         with: | ||||
|             node-version: '12' | ||||
|       - run: node ./node-red/.github/scripts/update-node-red-docker.js | ||||
|         id: updateFiles | ||||
|       - name: Create Pull Request | ||||
|       - name: Create Docker Pull Request | ||||
|         uses: peter-evans/create-pull-request@v2 | ||||
|         with: | ||||
|           token: ${{ secrets.NR_REPO_TOKEN }} | ||||
| @@ -37,4 +41,18 @@ jobs: | ||||
|  | ||||
|             Once this is merged, you will need to create a new release with the tag `v${{ env.newVersion }}`. | ||||
|  | ||||
|             This PR was auto-generated by a GitHub Action. Any questions, speak to @knolleary | ||||
|       - run: node ./node-red/.github/scripts/update-node-red-website.js | ||||
|       - name: Create Website Pull Request | ||||
|         uses: peter-evans/create-pull-request@v2 | ||||
|         with: | ||||
|           token: ${{ secrets.NR_REPO_TOKEN }} | ||||
|           committer: GitHub <noreply@github.com> | ||||
|           author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||||
|           path: 'node-red.github.io' | ||||
|           commit-message: 'Bump to ${{ env.newVersion }}' | ||||
|           title: '🚀 Update to Node-RED ${{ env.newVersion }} release' | ||||
|           body: | | ||||
|             Updates the Node-RED Website repo for the ${{ env.newVersion }} release. | ||||
|  | ||||
|             This PR was auto-generated by a GitHub Action. Any questions, speak to @knolleary | ||||
|   | ||||
		Reference in New Issue
	
	Block a user