init auto release project
This commit is contained in:
parent
a98bb90080
commit
de3da83f80
55
release/dist/index.js
vendored
55
release/dist/index.js
vendored
@ -31389,6 +31389,14 @@ function version(uuid) {
|
|||||||
var _default = version;
|
var _default = version;
|
||||||
exports["default"] = _default;
|
exports["default"] = _default;
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 1952:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
module.exports = eval("require")("gitea-api/dist/models/release");
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 9491:
|
/***/ 9491:
|
||||||
@ -33243,6 +33251,9 @@ var __webpack_exports__ = {};
|
|||||||
(() => {
|
(() => {
|
||||||
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2186);
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2186);
|
||||||
/* harmony import */ var gitea_api__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(5371);
|
/* harmony import */ var gitea_api__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(5371);
|
||||||
|
/* harmony import */ var gitea_api_dist_models_release__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(1952);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -33255,13 +33266,20 @@ async function run() {
|
|||||||
|
|
||||||
const [owner, repo] = repository.split("/");
|
const [owner, repo] = repository.split("/");
|
||||||
|
|
||||||
const gitea_client = new gitea_api__WEBPACK_IMPORTED_MODULE_1__/* .GiteaApi */ .D9({
|
const client = new gitea_api__WEBPACK_IMPORTED_MODULE_1__/* .GiteaApi */ .D9({
|
||||||
BASE: `https://${host}/api/v1`,
|
BASE: `https://${host}/api/v1`,
|
||||||
WITH_CREDENTIALS: true,
|
WITH_CREDENTIALS: true,
|
||||||
TOKEN: token,
|
TOKEN: token,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`TEST ${host} ${token} ${repository} ${owner} ${repo}`);
|
let releases = await client.repository.repoListReleases({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
});
|
||||||
|
|
||||||
|
let newVersion = getNewestRelease(releases);
|
||||||
|
|
||||||
|
console.log(`NEW RELEASE ${newVersion}`);
|
||||||
// console.log(`🎉 Release ready at ${response.html_url}`);
|
// console.log(`🎉 Release ready at ${response.html_url}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@ -33269,6 +33287,39 @@ async function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {Release[]} releases
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
async function getNewestRelease(releases) {
|
||||||
|
const initialVersion = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("initial-version");
|
||||||
|
|
||||||
|
const semVerParser = ([major, minor, patch]) => {
|
||||||
|
return version.replace("v", "").split(".").map(parseFloat);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isSemVerGreater = (a, b) => {
|
||||||
|
return (
|
||||||
|
a[0] > b[0] ||
|
||||||
|
(a[0] === b[0] && a[1] > b[1]) ||
|
||||||
|
(a[0] === b[0] && a[1] === b[1] && a[2] > b[2])
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let version = semVerParser(initialVersion);
|
||||||
|
|
||||||
|
for (let release of releases) {
|
||||||
|
let releaseVersion = semVerParser(release.tag_name);
|
||||||
|
|
||||||
|
if (isSemVerGreater(releaseVersion, version)) {
|
||||||
|
version = releaseVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return `v${version[0]}.${version[1]}.${version[2] + 1}`;
|
||||||
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -2,7 +2,7 @@ import core from "@actions/core";
|
|||||||
|
|
||||||
import gitea from "gitea-api";
|
import gitea from "gitea-api";
|
||||||
|
|
||||||
import type { Release } from "gitea-api/dist/models/release";
|
import { Release } from "gitea-api/dist/models/release";
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user