diff --git a/.github/workflows/e2e-test-sign.yml b/.github/workflows/e2e-test-sign.yml index 3fa99f5..7113f7f 100644 --- a/.github/workflows/e2e-test-sign.yml +++ b/.github/workflows/e2e-test-sign.yml @@ -217,4 +217,22 @@ jobs: run: | echo "Sign artifact missing target artifact reference should fail, but succeeded." exit 1 - \ No newline at end of file + + - name: clean up plugin + run: | + notation plugin uninstall e2e-test-plugin --yes + - name: Setup older Notation + uses: ./setup + with: + version: "1.0.0" + - name: Sign with older Notation + uses: ./sign + with: + plugin_name: e2e-test-plugin + plugin_url: https://github.com/notaryproject/notation-action/raw/e2e-test-plugin/tests/plugin_binaries/notation-e2e-test-plugin_0.1.0_linux_amd64.tar.gz + plugin_checksum: be8d035024d3a96afb4118af32f2e201f126c7254b02f7bcffb3e3149d744fd2 + key_id: ${{ env.E2E_CERT }} + target_artifact_reference: ${{ env.target_artifact_reference }} + signature_format: cose + plugin_config: |- + keyFile=${{ env.E2E_KEY }} \ No newline at end of file diff --git a/dist/sign.js b/dist/sign.js index 9f13009..3520916 100644 --- a/dist/sign.js +++ b/dist/sign.js @@ -50,6 +50,7 @@ const exec = __importStar(require("@actions/exec")); const tc = __importStar(require("@actions/tool-cache")); const path = __importStar(require("path")); const fs = __importStar(require("fs")); +const semver = __importStar(require("semver")); const checksum_1 = require("./lib/checksum"); const install_1 = require("./lib/install"); // plugin inputs from user @@ -132,6 +133,15 @@ function setupPlugin() { console.log(`plugin ${plugin_name} is already installed`); return; } + // downoad signign plugin via Notation + const { stdout: stdout } = yield exec.getExecOutput('notation', ['version']); + let versionOutput = stdout.split("\n"); + let notationVersion = semver.clean(versionOutput[2].split(":")[1].trim()); + if (semver.gte(String(notationVersion), '1.1.0')) { + console.log("installing signing plugin via Notation..."); + yield exec.getExecOutput('notation', ['plugin', 'install', '--url', plugin_url, '--sha256sum', plugin_checksum]); + return; + } // download signing plugin, validate checksum and plugin name console.log("downloading signing plugin..."); const pathToTarball = yield tc.downloadTool(plugin_url); diff --git a/dist/sign.js.map b/dist/sign.js.map index 2ede14e..95380f8 100644 --- a/dist/sign.js.map +++ b/dist/sign.js.map @@ -1 +1 @@ -{"version":3,"file":"sign.js","sourceRoot":"","sources":["../src/sign.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AACtC,oDAAsC;AACtC,wDAA0C;AAC1C,2CAA6B;AAC7B,uCAAyB;AACzB,6CAAoC;AACpC,2CAAgE;AAEhE,0BAA0B;AAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACjD,IAAI,CAAC,WAAW,EAAE,CAAC;IACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;IACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACpD,CAAC;AACD,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,WAAW,EAAE,CAAC;AACvE,IAAI,CAAC,eAAe,EAAE,CAAC;IACnB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;AACzD,CAAC;AACD,MAAM,oBAAoB,GAAG,YAAY,WAAW,EAAE,GAAG,IAAA,4BAAkB,GAAE,CAAC;AAE9E,gDAAgD;AAChD,SAAe,IAAI;;QACf,IAAI,CAAC;YACD,mBAAmB;YACnB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACvC,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;YACrD,MAAM,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;YACvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,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,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,EAAE,CAAC;YACT,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,CAAC;QACvD,CAAC;IACL,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC5B,CAAC;AAID,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC;AACX,CAAC;AAJD,iBAAS,IAAI,CAAC"} \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 1339247..f314757 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -73,6 +73,11 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==" + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", diff --git a/node_modules/@types/semver/LICENSE b/node_modules/@types/semver/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/semver/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/semver/README.md b/node_modules/@types/semver/README.md new file mode 100644 index 0000000..7876eac --- /dev/null +++ b/node_modules/@types/semver/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/semver` + +# Summary +This package contains type definitions for semver (https://github.com/npm/node-semver). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semver. + +### Additional Details + * Last updated: Sat, 24 Feb 2024 16:35:28 GMT + * Dependencies: none + +# Credits +These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [BendingBender](https://github.com/BendingBender), [Lucian Buzzo](https://github.com/LucianBuzzo), [Klaus Meinhardt](https://github.com/ajafff), [ExE Boss](https://github.com/ExE-Boss), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). diff --git a/node_modules/@types/semver/classes/comparator.d.ts b/node_modules/@types/semver/classes/comparator.d.ts new file mode 100644 index 0000000..8afae81 --- /dev/null +++ b/node_modules/@types/semver/classes/comparator.d.ts @@ -0,0 +1,17 @@ +import semver = require("../index"); +import SemVer = require("./semver"); + +declare class Comparator { + constructor(comp: string | Comparator, optionsOrLoose?: boolean | semver.Options); + + semver: SemVer; + operator: "" | "=" | "<" | ">" | "<=" | ">="; + value: string; + loose: boolean; + options: semver.Options; + parse(comp: string): void; + test(version: string | SemVer): boolean; + intersects(comp: Comparator, optionsOrLoose?: boolean | semver.Options): boolean; +} + +export = Comparator; diff --git a/node_modules/@types/semver/classes/range.d.ts b/node_modules/@types/semver/classes/range.d.ts new file mode 100644 index 0000000..925c4e8 --- /dev/null +++ b/node_modules/@types/semver/classes/range.d.ts @@ -0,0 +1,21 @@ +import semver = require("../index"); +import Comparator = require("./comparator"); +import SemVer = require("./semver"); + +declare class Range { + constructor(range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions); + + range: string; + raw: string; + loose: boolean; + options: semver.Options; + includePrerelease: boolean; + format(): string; + inspect(): string; + + set: ReadonlyArray; + parseRange(range: string): readonly Comparator[]; + test(version: string | SemVer): boolean; + intersects(range: Range, optionsOrLoose?: boolean | semver.Options): boolean; +} +export = Range; diff --git a/node_modules/@types/semver/classes/semver.d.ts b/node_modules/@types/semver/classes/semver.d.ts new file mode 100644 index 0000000..2112e2c --- /dev/null +++ b/node_modules/@types/semver/classes/semver.d.ts @@ -0,0 +1,64 @@ +import semver = require("../index"); + +declare class SemVer { + constructor(version: string | SemVer, optionsOrLoose?: boolean | semver.RangeOptions); + + raw: string; + loose: boolean; + options: semver.Options; + format(): string; + inspect(): string; + + major: number; + minor: number; + patch: number; + version: string; + build: readonly string[]; + prerelease: ReadonlyArray; + + /** + * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). + * + * @return + * - `0` if `this` == `other` + * - `1` if `this` is greater + * - `-1` if `other` is greater. + */ + compare(other: string | SemVer): 1 | 0 | -1; + + /** + * Compares the release portion of two versions. + * + * @return + * - `0` if `this` == `other` + * - `1` if `this` is greater + * - `-1` if `other` is greater. + */ + compareMain(other: string | SemVer): 1 | 0 | -1; + + /** + * Compares the prerelease portion of two versions. + * + * @return + * - `0` if `this` == `other` + * - `1` if `this` is greater + * - `-1` if `other` is greater. + */ + comparePre(other: string | SemVer): 1 | 0 | -1; + + /** + * Compares the build identifier of two versions. + * + * @return + * - `0` if `this` == `other` + * - `1` if `this` is greater + * - `-1` if `other` is greater. + */ + compareBuild(other: string | SemVer): 1 | 0 | -1; + + inc(release: semver.ReleaseType, identifier?: string): SemVer; + + toString(): string; +} + +export = SemVer; diff --git a/node_modules/@types/semver/functions/clean.d.ts b/node_modules/@types/semver/functions/clean.d.ts new file mode 100644 index 0000000..67d2491 --- /dev/null +++ b/node_modules/@types/semver/functions/clean.d.ts @@ -0,0 +1,8 @@ +import semver = require("../index"); + +/** + * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid. + */ +declare function clean(version: string, optionsOrLoose?: boolean | semver.Options): string | null; + +export = clean; diff --git a/node_modules/@types/semver/functions/cmp.d.ts b/node_modules/@types/semver/functions/cmp.d.ts new file mode 100644 index 0000000..dbd4e2d --- /dev/null +++ b/node_modules/@types/semver/functions/cmp.d.ts @@ -0,0 +1,16 @@ +import semver = require("../index"); +import SemVer = require("../classes/semver"); + +/** + * Pass in a comparison string, and it'll call the corresponding semver comparison function. + * "===" and "!==" do simple string comparison, but are included for completeness. + * Throws if an invalid comparison string is provided. + */ +declare function cmp( + v1: string | SemVer, + operator: semver.Operator, + v2: string | SemVer, + optionsOrLoose?: boolean | semver.Options, +): boolean; + +export = cmp; diff --git a/node_modules/@types/semver/functions/coerce.d.ts b/node_modules/@types/semver/functions/coerce.d.ts new file mode 100644 index 0000000..3d108b1 --- /dev/null +++ b/node_modules/@types/semver/functions/coerce.d.ts @@ -0,0 +1,12 @@ +import semver = require("../index"); +import SemVer = require("../classes/semver"); + +/** + * Coerces a string to SemVer if possible + */ +declare function coerce( + version: string | number | SemVer | null | undefined, + options?: semver.CoerceOptions, +): SemVer | null; + +export = coerce; diff --git a/node_modules/@types/semver/functions/compare-build.d.ts b/node_modules/@types/semver/functions/compare-build.d.ts new file mode 100644 index 0000000..2a16f29 --- /dev/null +++ b/node_modules/@types/semver/functions/compare-build.d.ts @@ -0,0 +1,21 @@ +import semver = require("../index"); +import SemVer = require("../classes/semver"); + +/** + * Compares two versions including build identifiers (the bit after `+` in the semantic version string). + * + * Sorts in ascending order when passed to `Array.sort()`. + * + * @return + * - `0` if `v1` == `v2` + * - `1` if `v1` is greater + * - `-1` if `v2` is greater. + * + * @since 6.1.0 + */ +declare function compareBuild( + a: string | SemVer, + b: string | SemVer, + optionsOrLoose?: boolean | semver.Options, +): 1 | 0 | -1; +export = compareBuild; diff --git a/node_modules/@types/semver/functions/compare-loose.d.ts b/node_modules/@types/semver/functions/compare-loose.d.ts new file mode 100644 index 0000000..140d6cf --- /dev/null +++ b/node_modules/@types/semver/functions/compare-loose.d.ts @@ -0,0 +1,5 @@ +import SemVer = require("../classes/semver"); + +declare function compareLoose(v1: string | SemVer, v2: string | SemVer): 1 | 0 | -1; + +export = compareLoose; diff --git a/node_modules/@types/semver/functions/compare.d.ts b/node_modules/@types/semver/functions/compare.d.ts new file mode 100644 index 0000000..92a1ab1 --- /dev/null +++ b/node_modules/@types/semver/functions/compare.d.ts @@ -0,0 +1,20 @@ +import semver = require("../index"); +import SemVer = require("../classes/semver"); + +/** + * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). + * + * Sorts in ascending order when passed to `Array.sort()`. + * + * @return + * - `0` if `v1` == `v2` + * - `1` if `v1` is greater + * - `-1` if `v2` is greater. + */ +declare function compare( + v1: string | SemVer, + v2: string | SemVer, + optionsOrLoose?: boolean | semver.Options, +): 1 | 0 | -1; + +export = compare; diff --git a/node_modules/@types/semver/functions/diff.d.ts b/node_modules/@types/semver/functions/diff.d.ts new file mode 100644 index 0000000..39b3623 --- /dev/null +++ b/node_modules/@types/semver/functions/diff.d.ts @@ -0,0 +1,9 @@ +import semver = require("../index"); +import SemVer = require("../classes/semver"); + +/** + * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. + */ +declare function diff(v1: string | SemVer, v2: string | SemVer): semver.ReleaseType | null; + +export = diff; diff --git a/node_modules/@types/semver/functions/eq.d.ts b/node_modules/@types/semver/functions/eq.d.ts new file mode 100644 index 0000000..126c859 --- /dev/null +++ b/node_modules/@types/semver/functions/eq.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. + */ +declare function eq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; + +export = eq; diff --git a/node_modules/@types/semver/functions/gt.d.ts b/node_modules/@types/semver/functions/gt.d.ts new file mode 100644 index 0000000..7739b3d --- /dev/null +++ b/node_modules/@types/semver/functions/gt.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * v1 > v2 + */ +declare function gt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; + +export = gt; diff --git a/node_modules/@types/semver/functions/gte.d.ts b/node_modules/@types/semver/functions/gte.d.ts new file mode 100644 index 0000000..38ce20b --- /dev/null +++ b/node_modules/@types/semver/functions/gte.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * v1 >= v2 + */ +declare function gte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; + +export = gte; diff --git a/node_modules/@types/semver/functions/inc.d.ts b/node_modules/@types/semver/functions/inc.d.ts new file mode 100644 index 0000000..87ccf50 --- /dev/null +++ b/node_modules/@types/semver/functions/inc.d.ts @@ -0,0 +1,25 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +declare namespace inc { + /** Base number to be used for the prerelease identifier */ + type IdentifierBase = "0" | "1"; +} + +/** + * Return the version incremented by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if it's not valid. + */ +declare function inc( + version: string | SemVer, + release: semver.ReleaseType, + optionsOrLoose?: boolean | semver.Options, + identifier?: string, +): string | null; +declare function inc( + version: string | SemVer, + release: semver.ReleaseType, + identifier?: string, + identifierBase?: inc.IdentifierBase | false, +): string | null; + +export = inc; diff --git a/node_modules/@types/semver/functions/lt.d.ts b/node_modules/@types/semver/functions/lt.d.ts new file mode 100644 index 0000000..e5d3cb9 --- /dev/null +++ b/node_modules/@types/semver/functions/lt.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * v1 < v2 + */ +declare function lt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; + +export = lt; diff --git a/node_modules/@types/semver/functions/lte.d.ts b/node_modules/@types/semver/functions/lte.d.ts new file mode 100644 index 0000000..9024398 --- /dev/null +++ b/node_modules/@types/semver/functions/lte.d.ts @@ -0,0 +1,8 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * v1 <= v2 + */ +declare function lte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; +export = lte; diff --git a/node_modules/@types/semver/functions/major.d.ts b/node_modules/@types/semver/functions/major.d.ts new file mode 100644 index 0000000..860c969 --- /dev/null +++ b/node_modules/@types/semver/functions/major.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the major version number. + */ +declare function major(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number; + +export = major; diff --git a/node_modules/@types/semver/functions/minor.d.ts b/node_modules/@types/semver/functions/minor.d.ts new file mode 100644 index 0000000..6595d83 --- /dev/null +++ b/node_modules/@types/semver/functions/minor.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the minor version number. + */ +declare function minor(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number; + +export = minor; diff --git a/node_modules/@types/semver/functions/neq.d.ts b/node_modules/@types/semver/functions/neq.d.ts new file mode 100644 index 0000000..ee3cf3d --- /dev/null +++ b/node_modules/@types/semver/functions/neq.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * v1 != v2 The opposite of eq. + */ +declare function neq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; + +export = neq; diff --git a/node_modules/@types/semver/functions/parse.d.ts b/node_modules/@types/semver/functions/parse.d.ts new file mode 100644 index 0000000..d333fd3 --- /dev/null +++ b/node_modules/@types/semver/functions/parse.d.ts @@ -0,0 +1,12 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the parsed version as a SemVer object, or null if it's not valid. + */ +declare function parse( + version: string | SemVer | null | undefined, + optionsOrLoose?: boolean | semver.Options, +): SemVer | null; + +export = parse; diff --git a/node_modules/@types/semver/functions/patch.d.ts b/node_modules/@types/semver/functions/patch.d.ts new file mode 100644 index 0000000..a9ee220 --- /dev/null +++ b/node_modules/@types/semver/functions/patch.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the patch version number. + */ +declare function patch(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number; + +export = patch; diff --git a/node_modules/@types/semver/functions/prerelease.d.ts b/node_modules/@types/semver/functions/prerelease.d.ts new file mode 100644 index 0000000..b6ba2e7 --- /dev/null +++ b/node_modules/@types/semver/functions/prerelease.d.ts @@ -0,0 +1,12 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Returns an array of prerelease components, or null if none exist. + */ +declare function prerelease( + version: string | SemVer, + optionsOrLoose?: boolean | semver.Options, +): ReadonlyArray | null; + +export = prerelease; diff --git a/node_modules/@types/semver/functions/rcompare.d.ts b/node_modules/@types/semver/functions/rcompare.d.ts new file mode 100644 index 0000000..71053d7 --- /dev/null +++ b/node_modules/@types/semver/functions/rcompare.d.ts @@ -0,0 +1,15 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * The reverse of compare. + * + * Sorts in descending order when passed to `Array.sort()`. + */ +declare function rcompare( + v1: string | SemVer, + v2: string | SemVer, + optionsOrLoose?: boolean | semver.Options, +): 1 | 0 | -1; + +export = rcompare; diff --git a/node_modules/@types/semver/functions/rsort.d.ts b/node_modules/@types/semver/functions/rsort.d.ts new file mode 100644 index 0000000..7c4e0b8 --- /dev/null +++ b/node_modules/@types/semver/functions/rsort.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Sorts an array of semver entries in descending order using `compareBuild()`. + */ +declare function rsort(list: T[], optionsOrLoose?: boolean | semver.Options): T[]; + +export = rsort; diff --git a/node_modules/@types/semver/functions/satisfies.d.ts b/node_modules/@types/semver/functions/satisfies.d.ts new file mode 100644 index 0000000..f240690 --- /dev/null +++ b/node_modules/@types/semver/functions/satisfies.d.ts @@ -0,0 +1,14 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return true if the version satisfies the range. + */ +declare function satisfies( + version: string | SemVer, + range: string | Range, + optionsOrLoose?: boolean | semver.RangeOptions, +): boolean; + +export = satisfies; diff --git a/node_modules/@types/semver/functions/sort.d.ts b/node_modules/@types/semver/functions/sort.d.ts new file mode 100644 index 0000000..239509e --- /dev/null +++ b/node_modules/@types/semver/functions/sort.d.ts @@ -0,0 +1,9 @@ +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Sorts an array of semver entries in ascending order using `compareBuild()`. + */ +declare function sort(list: T[], optionsOrLoose?: boolean | semver.Options): T[]; + +export = sort; diff --git a/node_modules/@types/semver/functions/valid.d.ts b/node_modules/@types/semver/functions/valid.d.ts new file mode 100644 index 0000000..707e5e7 --- /dev/null +++ b/node_modules/@types/semver/functions/valid.d.ts @@ -0,0 +1,11 @@ +import semver = require("../index"); +import SemVer = require("../classes/semver"); +/** + * Return the parsed version as a string, or null if it's not valid. + */ +declare function valid( + version: string | SemVer | null | undefined, + optionsOrLoose?: boolean | semver.Options, +): string | null; + +export = valid; diff --git a/node_modules/@types/semver/index.d.ts b/node_modules/@types/semver/index.d.ts new file mode 100644 index 0000000..62a994b --- /dev/null +++ b/node_modules/@types/semver/index.d.ts @@ -0,0 +1,129 @@ +// re-exports for index file + +// functions for working with versions +import semverParse = require("./functions/parse"); +import semverValid = require("./functions/valid"); +import semverClean = require("./functions/clean"); +import semverInc = require("./functions/inc"); +import semverDiff = require("./functions/diff"); +import semverMajor = require("./functions/major"); +import semverMinor = require("./functions/minor"); +import semverPatch = require("./functions/patch"); +import semverPrerelease = require("./functions/prerelease"); +import semverCompare = require("./functions/compare"); +import semverRcompare = require("./functions/rcompare"); +import semverCompareLoose = require("./functions/compare-loose"); +import semverCompareBuild = require("./functions/compare-build"); +import semverSort = require("./functions/sort"); +import semverRsort = require("./functions/rsort"); + +export { + semverClean as clean, + semverCompare as compare, + semverCompareBuild as compareBuild, + semverCompareLoose as compareLoose, + semverDiff as diff, + semverInc as inc, + semverMajor as major, + semverMinor as minor, + semverParse as parse, + semverPatch as patch, + semverPrerelease as prerelease, + semverRcompare as rcompare, + semverRsort as rsort, + semverSort as sort, + semverValid as valid, +}; + +// low-level comparators between versions +import semverGt = require("./functions/gt"); +import semverLt = require("./functions/lt"); +import semverEq = require("./functions/eq"); +import semverNeq = require("./functions/neq"); +import semverGte = require("./functions/gte"); +import semverLte = require("./functions/lte"); +import semverCmp = require("./functions/cmp"); +import semverCoerce = require("./functions/coerce"); + +export { + semverCmp as cmp, + semverCoerce as coerce, + semverEq as eq, + semverGt as gt, + semverGte as gte, + semverLt as lt, + semverLte as lte, + semverNeq as neq, +}; + +// working with ranges +import semverSatisfies = require("./functions/satisfies"); +import semverMaxSatisfying = require("./ranges/max-satisfying"); +import semverMinSatisfying = require("./ranges/min-satisfying"); +import semverToComparators = require("./ranges/to-comparators"); +import semverMinVersion = require("./ranges/min-version"); +import semverValidRange = require("./ranges/valid"); +import semverOutside = require("./ranges/outside"); +import semverGtr = require("./ranges/gtr"); +import semverLtr = require("./ranges/ltr"); +import semverIntersects = require("./ranges/intersects"); +import simplify = require("./ranges/simplify"); +import rangeSubset = require("./ranges/subset"); + +export { + rangeSubset as subset, + semverGtr as gtr, + semverIntersects as intersects, + semverLtr as ltr, + semverMaxSatisfying as maxSatisfying, + semverMinSatisfying as minSatisfying, + semverMinVersion as minVersion, + semverOutside as outside, + semverSatisfies as satisfies, + semverToComparators as toComparators, + semverValidRange as validRange, + simplify as simplifyRange, +}; + +// classes +import SemVer = require("./classes/semver"); +import Range = require("./classes/range"); +import Comparator = require("./classes/comparator"); + +export { Comparator, Range, SemVer }; + +// internals +import identifiers = require("./internals/identifiers"); +export import compareIdentifiers = identifiers.compareIdentifiers; +export import rcompareIdentifiers = identifiers.rcompareIdentifiers; + +export const SEMVER_SPEC_VERSION: "2.0.0"; + +export const RELEASE_TYPES: ReleaseType[]; + +export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease"; + +export interface Options { + loose?: boolean | undefined; +} + +export interface RangeOptions extends Options { + includePrerelease?: boolean | undefined; +} +export interface CoerceOptions extends Options { + includePrerelease?: boolean | undefined; + /** + * Used by `coerce()` to coerce from right to left. + * + * @default false + * + * @example + * coerce('1.2.3.4', { rtl: true }); + * // => SemVer { version: '2.3.4', ... } + * + * @since 6.2.0 + */ + rtl?: boolean | undefined; +} + +export type Operator = "===" | "!==" | "" | "=" | "==" | "!=" | ">" | ">=" | "<" | "<="; diff --git a/node_modules/@types/semver/internals/identifiers.d.ts b/node_modules/@types/semver/internals/identifiers.d.ts new file mode 100644 index 0000000..3666114 --- /dev/null +++ b/node_modules/@types/semver/internals/identifiers.d.ts @@ -0,0 +1,13 @@ +/** + * Compares two identifiers, must be numeric strings or truthy/falsy values. + * + * Sorts in ascending order when passed to `Array.sort()`. + */ +export function compareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; + +/** + * The reverse of compareIdentifiers. + * + * Sorts in descending order when passed to `Array.sort()`. + */ +export function rcompareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; diff --git a/node_modules/@types/semver/package.json b/node_modules/@types/semver/package.json new file mode 100644 index 0000000..8667184 --- /dev/null +++ b/node_modules/@types/semver/package.json @@ -0,0 +1,50 @@ +{ + "name": "@types/semver", + "version": "7.5.8", + "description": "TypeScript definitions for semver", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semver", + "license": "MIT", + "contributors": [ + { + "name": "Bart van der Schoor", + "githubUsername": "Bartvds", + "url": "https://github.com/Bartvds" + }, + { + "name": "BendingBender", + "githubUsername": "BendingBender", + "url": "https://github.com/BendingBender" + }, + { + "name": "Lucian Buzzo", + "githubUsername": "LucianBuzzo", + "url": "https://github.com/LucianBuzzo" + }, + { + "name": "Klaus Meinhardt", + "githubUsername": "ajafff", + "url": "https://github.com/ajafff" + }, + { + "name": "ExE Boss", + "githubUsername": "ExE-Boss", + "url": "https://github.com/ExE-Boss" + }, + { + "name": "Piotr Błażejewicz", + "githubUsername": "peterblazejewicz", + "url": "https://github.com/peterblazejewicz" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/semver" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "eeb34e966b621b4e47b2b11e63847d881e897b4ef9ec7a909c8d3730f7f3d6f8", + "typeScriptVersion": "4.6" +} \ No newline at end of file diff --git a/node_modules/@types/semver/preload.d.ts b/node_modules/@types/semver/preload.d.ts new file mode 100644 index 0000000..fad0950 --- /dev/null +++ b/node_modules/@types/semver/preload.d.ts @@ -0,0 +1,2 @@ +import semver = require("."); +export = semver; diff --git a/node_modules/@types/semver/ranges/gtr.d.ts b/node_modules/@types/semver/ranges/gtr.d.ts new file mode 100644 index 0000000..c56d82e --- /dev/null +++ b/node_modules/@types/semver/ranges/gtr.d.ts @@ -0,0 +1,14 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return true if version is greater than all the versions possible in the range. + */ +declare function gtr( + version: string | SemVer, + range: string | Range, + optionsOrLoose?: boolean | semver.RangeOptions, +): boolean; + +export = gtr; diff --git a/node_modules/@types/semver/ranges/intersects.d.ts b/node_modules/@types/semver/ranges/intersects.d.ts new file mode 100644 index 0000000..2cae343 --- /dev/null +++ b/node_modules/@types/semver/ranges/intersects.d.ts @@ -0,0 +1,13 @@ +import Range = require("../classes/range"); +import semver = require("../index"); + +/** + * Return true if any of the ranges comparators intersect + */ +declare function intersects( + range1: string | Range, + range2: string | Range, + optionsOrLoose?: boolean | semver.RangeOptions, +): boolean; + +export = intersects; diff --git a/node_modules/@types/semver/ranges/ltr.d.ts b/node_modules/@types/semver/ranges/ltr.d.ts new file mode 100644 index 0000000..e85e8c6 --- /dev/null +++ b/node_modules/@types/semver/ranges/ltr.d.ts @@ -0,0 +1,14 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return true if version is less than all the versions possible in the range. + */ +declare function ltr( + version: string | SemVer, + range: string | Range, + optionsOrLoose?: boolean | semver.RangeOptions, +): boolean; + +export = ltr; diff --git a/node_modules/@types/semver/ranges/max-satisfying.d.ts b/node_modules/@types/semver/ranges/max-satisfying.d.ts new file mode 100644 index 0000000..d9caa0e --- /dev/null +++ b/node_modules/@types/semver/ranges/max-satisfying.d.ts @@ -0,0 +1,14 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the highest version in the list that satisfies the range, or null if none of them do. + */ +declare function maxSatisfying( + versions: readonly T[], + range: string | Range, + optionsOrLoose?: boolean | semver.RangeOptions, +): T | null; + +export = maxSatisfying; diff --git a/node_modules/@types/semver/ranges/min-satisfying.d.ts b/node_modules/@types/semver/ranges/min-satisfying.d.ts new file mode 100644 index 0000000..def3ea7 --- /dev/null +++ b/node_modules/@types/semver/ranges/min-satisfying.d.ts @@ -0,0 +1,14 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the lowest version in the list that satisfies the range, or null if none of them do. + */ +declare function minSatisfying( + versions: readonly T[], + range: string | Range, + optionsOrLoose?: boolean | semver.RangeOptions, +): T | null; + +export = minSatisfying; diff --git a/node_modules/@types/semver/ranges/min-version.d.ts b/node_modules/@types/semver/ranges/min-version.d.ts new file mode 100644 index 0000000..b199557 --- /dev/null +++ b/node_modules/@types/semver/ranges/min-version.d.ts @@ -0,0 +1,10 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return the lowest version that can possibly match the given range. + */ +declare function minVersion(range: string | Range, optionsOrLoose?: boolean | semver.Options): SemVer | null; + +export = minVersion; diff --git a/node_modules/@types/semver/ranges/outside.d.ts b/node_modules/@types/semver/ranges/outside.d.ts new file mode 100644 index 0000000..7bb05f6 --- /dev/null +++ b/node_modules/@types/semver/ranges/outside.d.ts @@ -0,0 +1,15 @@ +import Range = require("../classes/range"); +import SemVer = require("../classes/semver"); +import semver = require("../index"); + +/** + * Return true if the version is outside the bounds of the range in either the high or low direction. + * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) + */ +declare function outside( + version: string | SemVer, + range: string | Range, + hilo: ">" | "<", + optionsOrLoose?: boolean | semver.RangeOptions, +): boolean; +export = outside; diff --git a/node_modules/@types/semver/ranges/simplify.d.ts b/node_modules/@types/semver/ranges/simplify.d.ts new file mode 100644 index 0000000..6c60f2c --- /dev/null +++ b/node_modules/@types/semver/ranges/simplify.d.ts @@ -0,0 +1,14 @@ +import Range = require("../classes/range"); +import semver = require("../index"); + +/** + * Return a "simplified" range that matches the same items in `versions` list as the range specified. + * Note that it does *not* guarantee that it would match the same versions in all cases, + * only for the set of versions provided. + * This is useful when generating ranges by joining together multiple versions with `||` programmatically, + * to provide the user with something a bit more ergonomic. + * If the provided range is shorter in string-length than the generated range, then that is returned. + */ +declare function simplify(ranges: string[], range: string | Range, options?: semver.Options): string | Range; + +export = simplify; diff --git a/node_modules/@types/semver/ranges/subset.d.ts b/node_modules/@types/semver/ranges/subset.d.ts new file mode 100644 index 0000000..c5a23a6 --- /dev/null +++ b/node_modules/@types/semver/ranges/subset.d.ts @@ -0,0 +1,9 @@ +import Range = require("../classes/range"); +import semver = require("../index"); + +/** + * Return true if the subRange range is entirely contained by the superRange range. + */ +declare function subset(sub: string | Range, dom: string | Range, options?: semver.RangeOptions): boolean; + +export = subset; diff --git a/node_modules/@types/semver/ranges/to-comparators.d.ts b/node_modules/@types/semver/ranges/to-comparators.d.ts new file mode 100644 index 0000000..4ea91fb --- /dev/null +++ b/node_modules/@types/semver/ranges/to-comparators.d.ts @@ -0,0 +1,9 @@ +import Range = require("../classes/range"); +import semver = require("../index"); + +/** + * Mostly just for testing and legacy API reasons + */ +declare function toComparators(range: string | Range, optionsOrLoose?: boolean | semver.Options): string[][]; + +export = toComparators; diff --git a/node_modules/@types/semver/ranges/valid.d.ts b/node_modules/@types/semver/ranges/valid.d.ts new file mode 100644 index 0000000..b681323 --- /dev/null +++ b/node_modules/@types/semver/ranges/valid.d.ts @@ -0,0 +1,12 @@ +import Range = require("../classes/range"); +import semver = require("../index"); + +/** + * Return the valid range or null if it's not valid + */ +declare function validRange( + range: string | Range | null | undefined, + optionsOrLoose?: boolean | semver.RangeOptions, +): string | null; + +export = validRange; diff --git a/package-lock.json b/package-lock.json index 9ebe956..dff33a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/tool-cache": "^2.0.1", - "@types/node": "^20.4.0" + "@types/node": "^20.4.0", + "@types/semver": "^7.5.8" } }, "node_modules/@actions/core": { @@ -84,6 +85,11 @@ "undici-types": "~5.26.4" } }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==" + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", diff --git a/package.json b/package.json index 7c8eccf..b34bc97 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/tool-cache": "^2.0.1", - "@types/node": "^20.4.0" + "@types/node": "^20.4.0", + "@types/semver": "^7.5.8" } } diff --git a/src/sign.ts b/src/sign.ts index 2122339..c068dcb 100644 --- a/src/sign.ts +++ b/src/sign.ts @@ -18,6 +18,7 @@ import * as exec from '@actions/exec'; import * as tc from '@actions/tool-cache'; import * as path from 'path'; import * as fs from 'fs'; +import * as semver from 'semver'; import {hash} from './lib/checksum'; import {getConfigHome, getBinaryExtension} from './lib/install'; @@ -63,7 +64,7 @@ async function sign(): Promise { } } if (targetArtifactReferenceList.length === 0) { - throw new Error("input target_artifact_reference does not contain any valid reference") + throw new Error("input target_artifact_reference does not contain any valid reference"); } // setting up notation signing plugin @@ -104,6 +105,16 @@ async function setupPlugin() { return; } + // downoad signign plugin via Notation + const {stdout: stdout} = await exec.getExecOutput('notation', ['version']); + let versionOutput = stdout.split("\n"); + let notationVersion = semver.clean(versionOutput[2].split(":")[1].trim()); + if (semver.gte(String(notationVersion), '1.1.0')) { + console.log("installing signing plugin via Notation..."); + await exec.getExecOutput('notation', ['plugin', 'install', '--url', plugin_url, '--sha256sum', plugin_checksum]); + return; + } + // download signing plugin, validate checksum and plugin name console.log("downloading signing plugin..."); const pathToTarball = await tc.downloadTool(plugin_url);