diff --git a/.github/workflows/bun.yml b/.github/workflows/bun.yml new file mode 100644 index 00000000000..dccf379ef43 --- /dev/null +++ b/.github/workflows/bun.yml @@ -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 diff --git a/main.js b/main.js new file mode 100644 index 00000000000..d60557dc404 --- /dev/null +++ b/main.js @@ -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(/([^<]+)/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'); \ No newline at end of file diff --git a/vivaldi-source/.gitkeep b/vivaldi-source/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d