mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: add release script
This commit is contained in:
		
							parent
							
								
									8651ff2cd5
								
							
						
					
					
						commit
						848cd3ffdb
					
				
							
								
								
									
										30
									
								
								.github/workflows/release.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								.github/workflows/release.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | ||||
| name: 'Publish to npm' | ||||
| on: | ||||
|   push: | ||||
|     tags: | ||||
|       - 'v*' | ||||
| 
 | ||||
| jobs: | ||||
|   build: | ||||
| 
 | ||||
|     runs-on: ubuntu-latest | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         node-version: [14.x] | ||||
| 
 | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|     - name: Publish to npm | ||||
|       uses: actions/setup-node@v3 | ||||
|       with: | ||||
|         node-version: ${{ matrix.node-version }} | ||||
|         registry-url: 'https://registry.npmjs.org' | ||||
|     - run: | | ||||
|         yarn install --frozen-lockfile | ||||
|     - run: | | ||||
|         LATEST=$(npm show unleash-server version) | ||||
|         TAG=$(node scripts/npm-tag.js $LATEST) | ||||
|         npm publish --tag ${TAG:-latest} | ||||
|       env: | ||||
|           NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||||
							
								
								
									
										18
									
								
								scripts/npm-tag.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								scripts/npm-tag.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | ||||
| const semver = require('semver'); | ||||
| 
 | ||||
| const latestUnleashVersion = process.argv[2]; | ||||
| 
 | ||||
| const version = require('../package.json').version; | ||||
| 
 | ||||
| function isPrerelease(version) { | ||||
|     const arr = semver.prerelease(version); | ||||
|     return arr && arr.length > 0; | ||||
| } | ||||
| 
 | ||||
| if(isPrerelease(version)){ | ||||
|     console.log('beta') | ||||
| }else if(semver.gt(version, latestUnleashVersion)) { | ||||
|     console.log('latest'); | ||||
| } else { | ||||
|     console.log('previous'); | ||||
| } | ||||
| @ -76,6 +76,7 @@ | ||||
|     "snapshots", | ||||
|     "coverage", | ||||
|     "website", | ||||
|     "setupJest.js" | ||||
|     "setupJest.js", | ||||
|     "scripts" | ||||
|   ] | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user