Compare commits

...

4 commits

Author SHA1 Message Date
Vladimir Borisov
ff78623e70
Fix checkout action
Some checks failed
Continuous integration / test (push) Has been cancelled
2026-03-10 12:13:52 +02:00
Vladimir Borisov
8a77e547bc
Update checkout action 2026-03-10 11:58:08 +02:00
Vladimir Borisov
95c718dd25
Version check 2026-03-10 10:54:23 +02:00
Vladimir Borisov
7461b2efcd
Better uploader 2026-02-05 13:48:58 +02:00
3 changed files with 80 additions and 2 deletions

View file

@ -11,7 +11,11 @@ jobs:
- name: disable git eol translation
run: git config --global core.autocrlf false
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check version
run: node stremiover.js check
- name: Stable with rustfmt and clippy
uses: actions-rust-lang/setup-rust-toolchain@v1
with:

69
stremiover.js Normal file
View file

@ -0,0 +1,69 @@
#!/usr/bin/env node
const { readFileSync, writeFileSync } = require('fs');
function getGitVersion() {
const { execSync } = require('child_process');
let ver = execSync('git describe --tags --abbrev=0').toString().match(/^v(?<version>\d+\.\d+.\d+)/);
if (ver === null || typeof ver.groups !== "object" || typeof ver.groups.version !== "string") return null;
return ver.groups.version;
}
function getCargoVersion(str) {
const psection = '[package]\n'
const poffset = str.indexOf(psection)
if (poffset === -1) {
console.error(`No ${psection}`)
return null;
}
const voffset = str.indexOf('\nversion', poffset + psection.length);
if (voffset === -1) {
console.error(`No version`)
return null;
} const vstart = str.indexOf('"', voffset) + 1;
if (vstart === 0) return null;
const vend = str.indexOf('"', vstart);
return { vstart, vend, version: str.slice(vstart, vend) }
}
switch (process.argv[2]) {
case 'check': {
const cver = getCargoVersion(readFileSync('Cargo.toml').toString());
const gver = getGitVersion();
if (gver !== cver.version) {
console.error(`Fatal error: the version in Cargo.toml (v${cver.version}) doesn't match latest tag (v${gver})!`);
process.exit(1);
}
console.log('Cargo versino matches the git tag ' + gver);
break;
}
case 'update': {
let newVer = process.argv[3];
if (!newVer) {
const ghv = getGitVersion().split('.')
const patch = (parseInt(ghv.pop(), 10) + 1).toString(10);
ghv.push(patch);
newVer = ghv.join('.');
console.log(`WRNING: No new version provided. Using GH version + 1`)
}
const toml = readFileSync('Cargo.toml').toString();
const cver = getCargoVersion(toml);
if (cver.version === newVer) {
console.log('Warinig: the new version is the same as the version in Cargo.toml')
}
const newtoml = toml.slice(0, cver.vstart) + newVer + toml.slice(cver.vend)
writeFileSync('Cargo.toml', newtoml);
console.log(`Cargo.toml updated to v${newVer}`);
console.log('Changes can be upstreamed by the following commands:\n');
console.log('git add Cargo.toml');
console.log(`git commit -m "Version updated to v${newVer}"`);
console.log(`git tag -a v${newVer} -m "Release of v${newVer}"`);
console.log('git push && git push --tags');
break;
}
default: {
console.log(`usage: ${process.argv[0]} check|update ver`);
break;
}
}

View file

@ -1,3 +1,8 @@
$tag = $(git describe --abbrev=0)
aws s3 cp --acl public-read ".\StremioSetup-v$((get-item .\StremioSetup*.exe).VersionInfo.ProductVersion.Trim()).exe" s3://stremio-artifacts/stremio-shell-ng/$tag/
foreach ($installer in (get-item .\StremioSetup*.exe)) {
if ($tag.StartsWith("v$($installer.VersionInfo.ProductVersion.Trim())")) {
aws s3 cp --acl public-read "$installer" s3://stremio-artifacts/stremio-shell-ng/$tag/
}
}
node ./generate_descriptor.js --tag=$tag