mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-03-11 21:27:06 +00:00
Compare commits
4 commits
1bf13bd4ff
...
ff78623e70
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff78623e70 | ||
|
|
8a77e547bc | ||
|
|
95c718dd25 | ||
|
|
7461b2efcd |
3 changed files with 80 additions and 2 deletions
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
|
|
@ -11,7 +11,11 @@ jobs:
|
||||||
- name: disable git eol translation
|
- name: disable git eol translation
|
||||||
run: git config --global core.autocrlf false
|
run: git config --global core.autocrlf false
|
||||||
- name: checkout
|
- 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
|
- name: Stable with rustfmt and clippy
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
69
stremiover.js
Normal file
69
stremiover.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
$tag = $(git describe --abbrev=0)
|
$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
|
node ./generate_descriptor.js --tag=$tag
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue