mirror of
				https://github.com/KaKi87/vivaldi-source.git
				synced 2025-07-20 01:05:36 +00:00 
			
		
		
		
	👷 Add GitHub Actions & Bun script
This commit is contained in:
		
							parent
							
								
									d22632715a
								
							
						
					
					
						commit
						94e2b81576
					
				
					 3 changed files with 62 additions and 0 deletions
				
			
		
							
								
								
									
										20
									
								
								.github/workflows/bun.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/bun.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | name: Bun Test | ||||||
|  | 
 | ||||||
|  | on: | ||||||
|  |   schedule: | ||||||
|  |     - cron: '0 0 * * *' | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   test: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  | 
 | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v4 | ||||||
|  | 
 | ||||||
|  |       - name: Setup Bun | ||||||
|  |         uses: oven-sh/setup-bun@v1 | ||||||
|  |         with: | ||||||
|  |           bun-version: latest | ||||||
|  | 
 | ||||||
|  |       - name: Run script | ||||||
|  |         run: bun main.js | ||||||
							
								
								
									
										42
									
								
								main.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								main.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | ||||||
|  | import { $ } from 'bun'; | ||||||
|  | 
 | ||||||
|  | console.log('Fetching versions'); | ||||||
|  | const items = | ||||||
|  |     await fetch('https://vivaldi.com/source/') | ||||||
|  |         .then(response => response.text()) | ||||||
|  |         .then(html => html.matchAll(/<a href="(https:\/\/source\.vivaldi\.com\/vivaldi-source_([0-9.]+)\.tar.xz)".+?modified hidemobile">([^<]+)/g)) | ||||||
|  |         .then(matches => [...matches]) | ||||||
|  |         .then(matches => matches.map(([ | ||||||
|  |             , url | ||||||
|  |             , version | ||||||
|  |             , date | ||||||
|  |         ]) => ({ | ||||||
|  |             url, | ||||||
|  |             version, | ||||||
|  |             date | ||||||
|  |         }))) | ||||||
|  |         .then(items => items.toReversed()); | ||||||
|  | console.log(`Fetched ${items.length} versions`); | ||||||
|  | for(const { | ||||||
|  |     url, | ||||||
|  |     version, | ||||||
|  |     date | ||||||
|  | } of items){ | ||||||
|  |     console.log(`Processing version ${version}`); | ||||||
|  |     if(await $`git tag -l ${version}`.text()){ | ||||||
|  |         console.log(`Version ${version} already exists`); | ||||||
|  |         continue; | ||||||
|  |     } | ||||||
|  |     console.log(`Downloading ${url}`); | ||||||
|  |     await $`curl -L ${url} | tar xJ`; | ||||||
|  |     console.log(`Staging version ${version}`); | ||||||
|  |     await $`git add vivaldi-source` | ||||||
|  |     console.log(`Committing version ${version}`); | ||||||
|  |     await $`git commit -m ${version} --date ${date}`; | ||||||
|  |     console.log(`Tagging version ${version}`); | ||||||
|  |     await $`git tag -a ${version} -m ${version}`; | ||||||
|  |     console.log(`Pushing version ${version}`); | ||||||
|  |     await $`git push`; | ||||||
|  |     console.log(`Version ${version} pushed`) | ||||||
|  | } | ||||||
|  | console.log('Done'); | ||||||
							
								
								
									
										0
									
								
								vivaldi-source/.gitkeep
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								vivaldi-source/.gitkeep
									
										
									
									
									
										Normal file
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue