Skip to content

Commit

Permalink
fix: Make release numbers follow the Debian Policy (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz authored Jun 17, 2024
1 parent 82e6f8f commit efce0cd
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 49 deletions.
36 changes: 31 additions & 5 deletions dist/build-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127255,6 +127255,7 @@ __webpack_async_result__();
"use strict";
__nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
/* harmony export */ "$l": () => (/* binding */ toDebianVersion),
/* harmony export */ "Mj": () => (/* binding */ installBinaryCached),
/* harmony export */ "ib": () => (/* binding */ packagesDebian),
/* harmony export */ "lY": () => (/* binding */ buildDebian)
Expand All @@ -127271,8 +127272,10 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
/* harmony import */ var _toml__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(79839);
/* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(28121);
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(81724);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__]);
_toml__WEBPACK_IMPORTED_MODULE_4__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
/* harmony import */ var _cargo__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(98683);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__]);
([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);




Expand Down Expand Up @@ -127402,7 +127405,7 @@ async function bumpDependencies(path, pattern, version, _branch) {
manifest.package.metadata.deb.depends != "$auto" &&
pattern.test(manifest.package.metadata.deb.name)) {
const deb = manifest.package.metadata.deb;
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${version})`);
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${cargo.toDebianVersion(version)})`);
core.info(`Changing ${deb.depends} to ${depends} in ${package_.name}`);
await toml.set(package_.manifestPath, ["package", "metadata", "deb", "depends"], depends);
}
Expand Down Expand Up @@ -127508,7 +127511,7 @@ function buildDebian(path, target, version) {
(0,_command__WEBPACK_IMPORTED_MODULE_5__.sh)(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version} \
--deb-version ${_cargo__WEBPACK_IMPORTED_MODULE_7__/* .toDebianVersion */ .$l(version)} \
--variant ${variant}`, {
cwd: path,
});
Expand All @@ -127518,12 +127521,35 @@ function buildDebian(path, target, version) {
(0,_command__WEBPACK_IMPORTED_MODULE_5__.sh)(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version}`, {
--deb-version ${_cargo__WEBPACK_IMPORTED_MODULE_7__/* .toDebianVersion */ .$l(version)}`, {
cwd: path,
});
}
}
}
/**
* Transforms a version number to a version number that conforms to the Debian Policy.
* @param version Version number.
* @param revision Package revision number.
* @returns Modified version.
*/
function toDebianVersion(version, revision) {
revision = revision ?? 1;
const re = /^(\d+\.\d+\.\d+)(?:-((?:alpha|beta|rc)\.\d+))?$/g;
const matches = Array.from(version.matchAll(re));
if (matches.length === 0) {
throw Error(`Unsupported version format: ${version}`);
}
const [base, suffix] = matches[0].slice(1);
if (suffix === undefined) {
// In this case the version is of the form X.Y.Z
return `${base}-${revision}`;
}
else {
// In this case the version is of the form X.Y.Z-(alpha|beta|rc).N
return `${base}~${suffix}-${revision}`;
}
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } }, 1);
Expand Down
37 changes: 31 additions & 6 deletions dist/build-crates-standalone-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127244,7 +127244,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
/* harmony export */ "KD": () => (/* binding */ hostTarget),
/* harmony export */ "Mj": () => (/* binding */ installBinaryCached)
/* harmony export */ });
/* unused harmony exports packages, packagesOrdered, bump, bumpDependencies, setRegistry, configRegistry, packagesDebian, buildDebian */
/* unused harmony exports packages, packagesOrdered, bump, bumpDependencies, setRegistry, configRegistry, packagesDebian, buildDebian, toDebianVersion */
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(22037);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(os__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(71017);
Expand All @@ -127256,8 +127256,10 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
/* harmony import */ var _toml__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(79839);
/* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(28121);
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(81724);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__]);
_toml__WEBPACK_IMPORTED_MODULE_4__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
/* harmony import */ var _cargo__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(98683);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__]);
([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);




Expand Down Expand Up @@ -127387,7 +127389,7 @@ async function bumpDependencies(path, pattern, version, _branch) {
manifest.package.metadata.deb.depends != "$auto" &&
pattern.test(manifest.package.metadata.deb.name)) {
const deb = manifest.package.metadata.deb;
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${version})`);
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${cargo.toDebianVersion(version)})`);
core.info(`Changing ${deb.depends} to ${depends} in ${package_.name}`);
await toml.set(package_.manifestPath, ["package", "metadata", "deb", "depends"], depends);
}
Expand Down Expand Up @@ -127493,7 +127495,7 @@ function buildDebian(path, target, version) {
sh(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version} \
--deb-version ${cargo.toDebianVersion(version)} \
--variant ${variant}`, {
cwd: path,
});
Expand All @@ -127503,12 +127505,35 @@ function buildDebian(path, target, version) {
sh(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version}`, {
--deb-version ${cargo.toDebianVersion(version)}`, {
cwd: path,
});
}
}
}
/**
* Transforms a version number to a version number that conforms to the Debian Policy.
* @param version Version number.
* @param revision Package revision number.
* @returns Modified version.
*/
function toDebianVersion(version, revision) {
revision = revision ?? 1;
const re = /^(\d+\.\d+\.\d+)(?:-((?:alpha|beta|rc)\.\d+))?$/g;
const matches = Array.from(version.matchAll(re));
if (matches.length === 0) {
throw Error(`Unsupported version format: ${version}`);
}
const [base, suffix] = matches[0].slice(1);
if (suffix === undefined) {
// In this case the version is of the form X.Y.Z
return `${base}-${revision}`;
}
else {
// In this case the version is of the form X.Y.Z-(alpha|beta|rc).N
return `${base}~${suffix}-${revision}`;
}
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } }, 1);
Expand Down
36 changes: 31 additions & 5 deletions dist/bump-crates-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80961,6 +80961,7 @@ __webpack_async_result__();
"use strict";
__nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
/* harmony export */ "$l": () => (/* binding */ toDebianVersion),
/* harmony export */ "HU": () => (/* binding */ bump),
/* harmony export */ "Mj": () => (/* binding */ installBinaryCached),
/* harmony export */ "UR": () => (/* binding */ bumpDependencies)
Expand All @@ -80977,8 +80978,10 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
/* harmony import */ var _toml__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(9839);
/* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(8121);
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(98);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__]);
_toml__WEBPACK_IMPORTED_MODULE_4__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
/* harmony import */ var _cargo__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(8683);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__]);
([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);




Expand Down Expand Up @@ -81108,7 +81111,7 @@ async function bumpDependencies(path, pattern, version, _branch) {
manifest.package.metadata.deb.depends != "$auto" &&
pattern.test(manifest.package.metadata.deb.name)) {
const deb = manifest.package.metadata.deb;
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${version})`);
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${_cargo__WEBPACK_IMPORTED_MODULE_7__/* .toDebianVersion */ .$l(version)})`);
_actions_core__WEBPACK_IMPORTED_MODULE_2__.info(`Changing ${deb.depends} to ${depends} in ${package_.name}`);
await toml.set(package_.manifestPath, ["package", "metadata", "deb", "depends"], depends);
}
Expand Down Expand Up @@ -81214,7 +81217,7 @@ function buildDebian(path, target, version) {
sh(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version} \
--deb-version ${cargo.toDebianVersion(version)} \
--variant ${variant}`, {
cwd: path,
});
Expand All @@ -81224,12 +81227,35 @@ function buildDebian(path, target, version) {
sh(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version}`, {
--deb-version ${cargo.toDebianVersion(version)}`, {
cwd: path,
});
}
}
}
/**
* Transforms a version number to a version number that conforms to the Debian Policy.
* @param version Version number.
* @param revision Package revision number.
* @returns Modified version.
*/
function toDebianVersion(version, revision) {
revision = revision ?? 1;
const re = /^(\d+\.\d+\.\d+)(?:-((?:alpha|beta|rc)\.\d+))?$/g;
const matches = Array.from(version.matchAll(re));
if (matches.length === 0) {
throw Error(`Unsupported version format: ${version}`);
}
const [base, suffix] = matches[0].slice(1);
if (suffix === undefined) {
// In this case the version is of the form X.Y.Z
return `${base}-${revision}`;
}
else {
// In this case the version is of the form X.Y.Z-(alpha|beta|rc).N
return `${base}~${suffix}-${revision}`;
}
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } }, 1);
Expand Down
37 changes: 31 additions & 6 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80853,7 +80853,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
/* harmony export */ "p3": () => (/* binding */ configRegistry),
/* harmony export */ "r4": () => (/* binding */ packagesOrdered)
/* harmony export */ });
/* unused harmony exports packages, bump, bumpDependencies, packagesDebian, build, hostTarget, buildDebian */
/* unused harmony exports packages, bump, bumpDependencies, packagesDebian, build, hostTarget, buildDebian, toDebianVersion */
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2037);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(os__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(1017);
Expand All @@ -80865,8 +80865,10 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
/* harmony import */ var _toml__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(9839);
/* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(8121);
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(98);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__]);
_toml__WEBPACK_IMPORTED_MODULE_4__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
/* harmony import */ var _cargo__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(8683);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__]);
([_toml__WEBPACK_IMPORTED_MODULE_4__, _cargo__WEBPACK_IMPORTED_MODULE_7__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);




Expand Down Expand Up @@ -80996,7 +80998,7 @@ async function bumpDependencies(path, pattern, version, _branch) {
manifest.package.metadata.deb.depends != "$auto" &&
pattern.test(manifest.package.metadata.deb.name)) {
const deb = manifest.package.metadata.deb;
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${version})`);
const depends = deb.depends.replaceAll(/\(=[^\(\)]+\)/g, `(=${cargo.toDebianVersion(version)})`);
core.info(`Changing ${deb.depends} to ${depends} in ${package_.name}`);
await toml.set(package_.manifestPath, ["package", "metadata", "deb", "depends"], depends);
}
Expand Down Expand Up @@ -81102,7 +81104,7 @@ function buildDebian(path, target, version) {
sh(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version} \
--deb-version ${cargo.toDebianVersion(version)} \
--variant ${variant}`, {
cwd: path,
});
Expand All @@ -81112,12 +81114,35 @@ function buildDebian(path, target, version) {
sh(`cargo deb --no-build --no-strip \
--target ${target} \
--package ${package_.name} \
--deb-version ${version}`, {
--deb-version ${cargo.toDebianVersion(version)}`, {
cwd: path,
});
}
}
}
/**
* Transforms a version number to a version number that conforms to the Debian Policy.
* @param version Version number.
* @param revision Package revision number.
* @returns Modified version.
*/
function toDebianVersion(version, revision) {
revision = revision ?? 1;
const re = /^(\d+\.\d+\.\d+)(?:-((?:alpha|beta|rc)\.\d+))?$/g;
const matches = Array.from(version.matchAll(re));
if (matches.length === 0) {
throw Error(`Unsupported version format: ${version}`);
}
const [base, suffix] = matches[0].slice(1);
if (suffix === undefined) {
// In this case the version is of the form X.Y.Z
return `${base}-${revision}`;
}
else {
// In this case the version is of the form X.Y.Z-(alpha|beta|rc).N
return `${base}~${suffix}-${revision}`;
}
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } }, 1);
Expand Down
Loading

0 comments on commit efce0cd

Please sign in to comment.