-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e6a389
commit 57cbc5a
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: 'Tag version' | ||
description: 'Sets the version to "versionToRelease", creates a tag and bump to the next patch SNAPSHOT' | ||
inputs: | ||
versionToRelease: | ||
description: 'The version to release' | ||
required: true | ||
|
||
runs: | ||
using: 'node20' | ||
main: 'index.js' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Most of this code has been copied from the following GitHub Action | ||
* to make it simpler or not necessary to install a lot of | ||
* JavaScript packages to execute a shell script. | ||
* | ||
* https://github.com/ad-m/github-push-action/blob/fe38f0a751bf9149f0270cc1fe20bf9156854365/start.js | ||
*/ | ||
|
||
const spawn = require('child_process').spawn; | ||
const path = require("path"); | ||
|
||
const exec = (cmd, args=[]) => new Promise((resolve, reject) => { | ||
console.log(`Started: ${cmd} ${args.join(" ")}`) | ||
const app = spawn(cmd, args, { stdio: 'inherit' }); | ||
app.on('close', code => { | ||
if(code !== 0){ | ||
err = new Error(`Invalid status code: ${code}`); | ||
err.code = code; | ||
return reject(err); | ||
}; | ||
return resolve(code); | ||
}); | ||
app.on('error', reject); | ||
}); | ||
|
||
const main = async () => { | ||
await exec('kotlin', [path.join(__dirname, './tag-version.main.kts')]); | ||
}; | ||
|
||
main().catch(err => { | ||
console.error(err); | ||
console.error(err.stack); | ||
process.exit(err.code || -1); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env kotlin | ||
|
||
@file:DependsOn("com.gradleup.librarian:core:0.0.3") | ||
|
||
import com.gradleup.librarian.core.tooling.commitRelease | ||
|
||
|
||
fun getInput(name: String): String { | ||
return getOptionalInput(name) ?: error("Cannot find an input for $name") | ||
} | ||
|
||
fun getOptionalInput(name: String): String? { | ||
return System.getenv("INPUT_${name.uppercase()}")?.ifBlank { | ||
null | ||
} | ||
} | ||
|
||
commitRelease(getInput("versionToRelease")) |