diff --git a/.eslintrc.yml b/.eslintrc.yml index bbe1f10..07b4cfe 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -3,9 +3,9 @@ env: # https://eslint.org/docs/user-guide/configuring#specifying-environments es6: true node: true extends: - - eslint:recommended - - plugin:@typescript-eslint/eslint-recommended - - plugin:@typescript-eslint/recommended +- eslint:recommended +- plugin:@typescript-eslint/eslint-recommended +- plugin:@typescript-eslint/recommended plugins: - import - "@typescript-eslint" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc6c845..5eb72b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Turn off auto-crlf run: git config --global core.autocrlf false - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install Node.js uses: actions/setup-node@v1 with: diff --git a/.github/workflows/verify-on-macos.yml b/.github/workflows/verify-on-macos.yml index 9fd095f..3bf6061 100644 --- a/.github/workflows/verify-on-macos.yml +++ b/.github/workflows/verify-on-macos.yml @@ -8,7 +8,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: @@ -23,7 +23,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: diff --git a/.github/workflows/verify-on-ubuntu.yml b/.github/workflows/verify-on-ubuntu.yml index e35a29d..960eecd 100644 --- a/.github/workflows/verify-on-ubuntu.yml +++ b/.github/workflows/verify-on-ubuntu.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: diff --git a/.github/workflows/verify-on-ubuntu1604.yml b/.github/workflows/verify-on-ubuntu1604.yml index 8c8a87b..e4afd53 100644 --- a/.github/workflows/verify-on-ubuntu1604.yml +++ b/.github/workflows/verify-on-ubuntu1604.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-16.04 steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-16.04 steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: diff --git a/.github/workflows/verify-on-windows.yml b/.github/workflows/verify-on-windows.yml index 7e40adb..9615c88 100644 --- a/.github/workflows/verify-on-windows.yml +++ b/.github/workflows/verify-on-windows.yml @@ -8,7 +8,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: @@ -23,7 +23,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout source codes - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install SSH key uses: ./. with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1525d69..7328163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.6.5] - 2020-02-08 + +### Others + +* update version of [Checkout](https://github.com/marketplace/actions/checkout) action + ## [1.6.4] - 2020-01-27 ### Fixed @@ -77,7 +83,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * First release. -[Unreleased]: https://github.com/shimataro/ssh-key-action/compare/v1.6.4...HEAD +[Unreleased]: https://github.com/shimataro/ssh-key-action/compare/v1.6.5...HEAD +[1.6.5]: https://github.com/shimataro/ssh-key-action/compare/v1.6.4...v1.6.5 [1.6.4]: https://github.com/shimataro/ssh-key-action/compare/v1.6.3...v1.6.4 [1.6.3]: https://github.com/shimataro/ssh-key-action/compare/v1.6.2...v1.6.3 [1.6.2]: https://github.com/shimataro/ssh-key-action/compare/v1.6.1...v1.6.2 diff --git a/README.md b/README.md index 55fa515..f206c16 100644 --- a/README.md +++ b/README.md @@ -126,15 +126,15 @@ The scripts and documentation in this project are released under the [MIT Licens See [CHANGELOG.md](CHANGELOG.md). [image-build]: https://github.com/shimataro/ssh-key-action/workflows/Build/badge.svg?event=push&branch=v1 -[link-build]: https://github.com/shimataro/ssh-key-action +[link-build]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3ABuild [image-verify-windows]: https://github.com/shimataro/ssh-key-action/workflows/Windows/badge.svg?event=push&branch=v1 -[link-verify-windows]: https://github.com/shimataro/ssh-key-action +[link-verify-windows]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3AWindows [image-verify-macos]: https://github.com/shimataro/ssh-key-action/workflows/macOS/badge.svg?event=push&branch=v1 -[link-verify-macos]: https://github.com/shimataro/ssh-key-action +[link-verify-macos]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3AmacOS [image-verify-ubuntu]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu/badge.svg?event=push&branch=v1 -[link-verify-ubuntu]: https://github.com/shimataro/ssh-key-action +[link-verify-ubuntu]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3AUbuntu [image-verify-ubuntu1604]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu%2016.04/badge.svg?event=push&branch=v1 -[link-verify-ubuntu1604]: https://github.com/shimataro/ssh-key-action +[link-verify-ubuntu1604]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3A%22Ubuntu+16.04%22 [image-release]: https://img.shields.io/github/release/shimataro/ssh-key-action.svg [link-release]: https://github.com/shimataro/ssh-key-action/releases [image-license]: https://img.shields.io/github/license/shimataro/ssh-key-action.svg diff --git a/lib/main.js b/lib/main.js index 1360411..9b04913 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,4 +1,7 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; @@ -7,8 +10,8 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); +const fs_1 = __importDefault(require("fs")); +const path_1 = __importDefault(require("path")); const core = __importStar(require("@actions/core")); /** * main function @@ -45,15 +48,15 @@ function main() { ]; // create ".ssh" directory const home = getHomeDirectory(); - const dirName = path.resolve(home, ".ssh"); - fs.mkdirSync(dirName, { + const dirName = path_1.default.resolve(home, ".ssh"); + fs_1.default.mkdirSync(dirName, { recursive: true, mode: 0o700, }); // create files for (const file of files) { - const fileName = path.join(dirName, file.name); - fs.writeFileSync(fileName, file.contents, file.options); + const fileName = path_1.default.join(dirName, file.name); + fs_1.default.writeFileSync(fileName, file.contents, file.options); } console.log(`SSH key has been stored to ${dirName} successfully.`); } diff --git a/lib/main.js.map b/lib/main.js.map index 6148a6d..66e1d00 100644 --- a/lib/main.js.map +++ b/lib/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,oDAAsC;AAStC;;GAEG;AACH,SAAS,IAAI;IAEZ,IACA;QACC,MAAM,KAAK,GAAe;YACzB;gBACC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;oBACtC,QAAQ,EAAE,IAAI;iBACd,CAAC;gBACF,OAAO,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,IAAI;iBACV;aACD;YACD;gBACC,IAAI,EAAE,aAAa;gBACnB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;gBAC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AAU;IAElB,IAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,EAC/B;QACC,UAAU;QACV,OAAO,aAAa,CAAC;KACrB;IAED,gBAAgB;IAChB,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAa;IAE/B,IAAG,KAAK,CAAC,MAAM,KAAK,CAAC,EACrB;QACC,sBAAsB;QACtB,OAAO,EAAE,CAAC;KACV;IAED,OAAO,KAAK,KAAK,EAAE,CAAC;AACrB,CAAC;AAED,IAAI,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,oDAAsC;AAStC;;GAEG;AACH,SAAS,IAAI;IAEZ,IACA;QACC,MAAM,KAAK,GAAe;YACzB;gBACC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;oBACtC,QAAQ,EAAE,IAAI;iBACd,CAAC;gBACF,OAAO,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,IAAI;iBACV;aACD;YACD;gBACC,IAAI,EAAE,aAAa;gBACnB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;gBACjD,OAAO,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,GAAG;iBACT;aACD;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAC5C,OAAO,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,GAAG;iBACT;aACD;SACD,CAAC;QAEF,0BAA0B;QAC1B,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAC;QAChC,MAAM,OAAO,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\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5a06dc2..7ca97ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "install-ssh-key", - "version": "1.6.4", + "version": "1.6.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -30,9 +30,9 @@ } }, "@npmcli/ci-detect": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-1.1.1.tgz", - "integrity": "sha512-h5eW3DljLypyhvfK94FkSSm4qtSUFddth/xW+7vnkVCEUJR38MYvctCSZkxqrzmXZSzpfImuAwwKvRqkEuDvCQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-1.2.0.tgz", + "integrity": "sha512-JtktVH7ASBVIWsQTFlFpeOzhBJskvoBCTfeeRhhZy7ybATcUvwiwotZ8j5rkqUUyB69lIy/AvboiiiGBjYBKBA==", "dev": true }, "@npmcli/installed-package-contents": { @@ -81,18 +81,18 @@ "dev": true }, "@types/node": { - "version": "13.5.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.5.0.tgz", - "integrity": "sha512-Onhn+z72D2O2Pb2ql2xukJ55rglumsVo1H6Fmyi8mlU9SvKdBk/pUSUAiBY/d9bAOF7VVWajX3sths/+g6ZiAQ==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.0.tgz", + "integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ==", "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.17.0.tgz", - "integrity": "sha512-tg/OMOtPeXlvk0ES8mZzEZ4gd1ruSE03nsKcK+teJhxYv5CPCXK6Mb/OK6NpB4+CqGTHs4MVeoSZXNFqpT1PyQ==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.19.0.tgz", + "integrity": "sha512-u7IcQ9qwsB6U806LupZmINRnQjC+RJyv36sV/ugaFWMHTbFm/hlLTRx3gGYJgHisxcGSTnf+I/fPDieRMhPSQQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.17.0", + "@typescript-eslint/experimental-utils": "2.19.0", "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -100,32 +100,32 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.17.0.tgz", - "integrity": "sha512-2bNf+mZ/3mj5/3CP56v+ldRK3vFy9jOvmCPs/Gr2DeSJh+asPZrhFniv4QmQsHWQFPJFWhFHgkGgJeRmK4m8iQ==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.0.tgz", + "integrity": "sha512-zwpg6zEOPbhB3+GaQfufzlMUOO6GXCNZq6skk+b2ZkZAIoBhVoanWK255BS1g5x9bMwHpLhX0Rpn5Fc3NdCZdg==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.17.0", + "@typescript-eslint/typescript-estree": "2.19.0", "eslint-scope": "^5.0.0" } }, "@typescript-eslint/parser": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.17.0.tgz", - "integrity": "sha512-k1g3gRQ4fwfJoIfgUpz78AovicSWKFANmvTfkAHP24MgJHjWfZI6ya7tsQZt1sLczvP4G9BE5G5MgADHdmJB/w==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.19.0.tgz", + "integrity": "sha512-s0jZoxAWjHnuidbbN7aA+BFVXn4TCcxEVGPV8lWMxZglSs3NRnFFAlL+aIENNmzB2/1jUJuySi6GiM6uACPmpg==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.17.0", - "@typescript-eslint/typescript-estree": "2.17.0", + "@typescript-eslint/experimental-utils": "2.19.0", + "@typescript-eslint/typescript-estree": "2.19.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.17.0.tgz", - "integrity": "sha512-g0eVRULGnEEUakxRfJO0s0Hr1LLQqsI6OrkiCLpdHtdJJek+wyd8mb00vedqAoWldeDcOcP8plqw8/jx9Gr3Lw==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.0.tgz", + "integrity": "sha512-n6/Xa37k0jQdwpUszffi19AlNbVCR0sdvCs3DmSKMD7wBttKY31lhD2fug5kMD91B2qW4mQldaTEc1PEzvGu8w==", "dev": true, "requires": { "debug": "^4.1.1", @@ -370,9 +370,9 @@ "dev": true }, "cacache": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", - "integrity": "sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-14.0.0.tgz", + "integrity": "sha512-+Nr/BnA/tjAUXza9gH8F+FSP+1HvWqCKt4c95dQr4EDVJVafbzmPZpLKCkLYexs6vSd2B/1TOXrAoNnqVPfvRA==", "dev": true, "requires": { "chownr": "^1.1.2", @@ -386,15 +386,22 @@ "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.2", - "mkdirp": "^0.5.1", + "mkdirp": "^1.0.3", "move-concurrently": "^1.0.1", "p-map": "^3.0.0", "promise-inflight": "^1.0.1", "rimraf": "^2.7.1", "ssri": "^7.0.0", + "tar": "^6.0.0", "unique-filename": "^1.1.1" }, "dependencies": { + "mkdirp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -730,9 +737,9 @@ "dev": true }, "defer-to-connect": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.1.tgz", - "integrity": "sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", "dev": true }, "define-properties": { @@ -989,9 +996,9 @@ } }, "eslint-plugin-import": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.0.tgz", - "integrity": "sha512-NK42oA0mUc8Ngn4kONOPsPB1XhbUvNHqF+g307dPV28aknPoiNnKLFd9em4nkswwepdF5ouieqv5Th/63U7YJQ==", + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz", + "integrity": "sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==", "dev": true, "requires": { "array-includes": "^3.0.3", @@ -2064,13 +2071,13 @@ } }, "make-fetch-happen": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-7.1.0.tgz", - "integrity": "sha512-/5ICTcpd4ApIRn76pxcl4aQhrWxdDCnRDy3y+Tu7DbRsfqde6q8OYXUm7bYhH5dSey590AMT0RH9LDFq7v5KRA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-7.1.1.tgz", + "integrity": "sha512-7fNjiOXNZhNGQzG5P15nU97aZQtzPU2GVgVd7pnqnl5gnpLzMAD8bAe5YG4iW2s0PTqaZy9xGv4Wfqe872kRNQ==", "dev": true, "requires": { "agentkeepalive": "^4.1.0", - "cacache": "^13.0.1", + "cacache": "^14.0.0", "http-cache-semantics": "^4.0.3", "http-proxy-agent": "^3.0.0", "https-proxy-agent": "^4.0.0", @@ -2476,9 +2483,9 @@ "dev": true }, "commander": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz", - "integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", "dev": true }, "find-up": { @@ -2581,9 +2588,9 @@ } }, "semver": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.1.tgz", - "integrity": "sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", "dev": true } } @@ -2612,9 +2619,9 @@ }, "dependencies": { "semver": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.1.tgz", - "integrity": "sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", "dev": true } } @@ -2645,9 +2652,9 @@ "dev": true }, "semver": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.1.tgz", - "integrity": "sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", "dev": true } } @@ -2891,19 +2898,20 @@ } }, "pacote": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-10.3.0.tgz", - "integrity": "sha512-Qq4nZkTyjKvNWj0TKfV29Q9416RQ9hALPjU5ej6ckavV1WLcurc0aZqJBKcAf2OHX6RuE1fi0N+TBCP9EyM1+Q==", + "version": "10.3.2", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-10.3.2.tgz", + "integrity": "sha512-Hem2RkLAHhNaJSbhjouhbCAXlinNsv9W75s6JNxv9GypIjFkHtxCBoV6+GYBPttVOpZqnTAHmYRLs8yc2X2Dnw==", "dev": true, "requires": { "@npmcli/installed-package-contents": "^1.0.5", - "cacache": "^13.0.1", + "cacache": "^14.0.0", "chownr": "^1.1.3", - "fs-minipass": "^2.0.0", + "fs-minipass": "^2.1.0", "infer-owner": "^1.0.4", "lru-cache": "^5.1.1", "minipass": "^3.0.1", "minipass-fetch": "^1.2.1", + "mkdirp": "^1.0.3", "npm-package-arg": "^8.0.0", "npm-packlist": "^2.0.3", "npm-pick-manifest": "^5.0.0", @@ -2911,17 +2919,23 @@ "osenv": "^0.1.5", "promise-inflight": "^1.0.1", "promise-retry": "^1.1.1", - "read-package-json-fast": "^1.1.1", + "read-package-json-fast": "^1.1.3", "semver": "^7.1.1", "ssri": "^7.1.0", - "tar": "^5.0.5", + "tar": "^6.0.0", "which": "^2.0.2" }, "dependencies": { + "mkdirp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true + }, "semver": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.1.tgz", - "integrity": "sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.2.tgz", + "integrity": "sha512-BJs9T/H8sEVHbeigqzIEo57Iu/3DG6c4QoqTfbQB3BPA4zgzAomh/Fk9E7QtjWQ8mx2dgA9YCfSF4y9k9bHNpQ==", "dev": true }, "which": { @@ -3240,9 +3254,9 @@ } }, "resolve": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz", - "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -3648,17 +3662,25 @@ } }, "tar": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/tar/-/tar-5.0.5.tgz", - "integrity": "sha512-MNIgJddrV2TkuwChwcSNds/5E9VijOiw7kAc1y5hTNJoLDSuIyid2QtLYiCYNnICebpuvjhPQZsXwUL0O3l7OQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.1.tgz", + "integrity": "sha512-bKhKrrz2FJJj5s7wynxy/fyxpE0CmCjmOQ1KV4KkgXFWOgoIT/NbTMnB1n+LFNrNk0SSBVGGxcK5AGsyC+pW5Q==", "dev": true, "requires": { "chownr": "^1.1.3", "fs-minipass": "^2.0.0", "minipass": "^3.0.0", "minizlib": "^2.1.0", - "mkdirp": "^0.5.0", + "mkdirp": "^1.0.3", "yallist": "^4.0.0" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true + } } }, "term-size": { diff --git a/package.json b/package.json index 4c46693..b0121c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "install-ssh-key", - "version": "1.6.4", + "version": "1.6.5", "private": true, "description": "Install SSH key in .ssh", "main": "lib/main.js", @@ -34,11 +34,11 @@ "@actions/core": "1.2.2" }, "devDependencies": { - "@types/node": "13.5.0", - "@typescript-eslint/eslint-plugin": "2.17.0", - "@typescript-eslint/parser": "2.17.0", + "@types/node": "13.7.0", + "@typescript-eslint/eslint-plugin": "2.19.0", + "@typescript-eslint/parser": "2.19.0", "eslint": "6.8.0", - "eslint-plugin-import": "2.20.0", + "eslint-plugin-import": "2.20.1", "markdownlint-cli": "0.21.0", "npm-check-updates": "4.0.1", "npm-run-all": "4.1.5", diff --git a/scripts/create-release-branch.sh b/scripts/create-release-branch.sh index 65b0f72..8c9ee39 100755 --- a/scripts/create-release-branch.sh +++ b/scripts/create-release-branch.sh @@ -39,12 +39,7 @@ function main() { check_current_branch create_branch ${BRANCH} - update_changelog ${VERSION} - update_package_version ${VERSION} - update_dependencies_version - regenerate_package_lock - build_package - commit_changes ${VERSION} + ./scripts/prepare-release.sh ${VERSION} finish ${VERSION} ${BRANCH} ${TAG} } @@ -52,19 +47,19 @@ function usage() { local COMMAND=`basename ${0}` echo -e "${COLOR_SECTION}NAME${COLOR_RESET} - ${COMMAND} - Prepare for new release + ${COMMAND} - Create a branch and prepare for new release ${COLOR_SECTION}SYNOPSIS${COLOR_RESET} ${COLOR_COMMAND_NAME}${COMMAND}${COLOR_RESET} <${COLOR_OPTION}new-version${COLOR_RESET}> ${COLOR_SECTION}DESCRIPTION${COLOR_RESET} - This command will... - - create a new branch for release - - update ${COLOR_FILE}CHANGELOG.md${COLOR_RESET} - - update package version in ${COLOR_FILE}package.json${COLOR_RESET} - - update dependencies version in ${COLOR_FILE}package.json${COLOR_RESET} - - verify - - ...and commit! + This command: + - creates a new branch for release + - updates ${COLOR_FILE}CHANGELOG.md${COLOR_RESET} + - updates package version in ${COLOR_FILE}package.json${COLOR_RESET} + - updates dependencies version in ${COLOR_FILE}package.json${COLOR_RESET} + - verifies + - ...and commits! ${COLOR_OPTION}new-version${COLOR_RESET} must follow \"Semantic Versioning\" . " @@ -99,49 +94,6 @@ function create_branch() { git checkout -b ${BRANCH} ${BASE_BRANCH} } -function update_changelog() { - local VERSION=$1 - local DATE=`date "+%Y-%m-%d"` - local KEYWORD="Unreleased" - - sed -i".bak" -r \ - -e "s/^((##\s+)\[${KEYWORD}\])$/\1\n\n\2[${VERSION}] - ${DATE}/" \ - -e "s/^(\[${KEYWORD}\](.*))(v.*)\.\.\.HEAD$/\1v${VERSION}...HEAD\n[${VERSION}]\2\3...v${VERSION}/" \ - CHANGELOG.md -} - -function update_package_version() { - local VERSION=$1 - - sed -i".bak" -r \ - -e "s/(\"version\"\s*:\s*)\".*?\"/\1\"${VERSION}\"/" \ - package.json -} - -function update_dependencies_version() { - npm ci - npm run check-updates -- -u -} - -function regenerate_package_lock() { - rm -rf package-lock.json node_modules - npm install -} - -function build_package() { - npm run build - npm run verify -} - -function commit_changes() { - local VERSION=$1 - - rm -rf node_modules - npm ci --only=production - git add CHANGELOG.md package.json package-lock.json node_modules lib - git commit -m "version ${VERSION}" -} - function finish() { local VERSION=$1 local BRANCH=$2 @@ -157,13 +109,13 @@ Remaining processes are... 2. Push to remote origin ${COLOR_COMMAND}git push --set-upstream origin ${BRANCH}${COLOR_RESET} 3. Create a pull-request: ${COLOR_BRANCH}${BRANCH}${COLOR_RESET} to ${COLOR_BRANCH}${BASE_BRANCH}${COLOR_RESET} - ${URL_COMPARE}/${BASE_BRANCH}...${BRANCH} + ${URL_COMPARE}/${BASE_BRANCH}...${BRANCH}?expand=1 select ${COLOR_SELECT}Squash and merge${COLOR_RESET} 4. Create a pull-request: ${COLOR_BRANCH}${BASE_BRANCH}${COLOR_RESET} to ${COLOR_BRANCH}${TARGET_BRANCH}${COLOR_RESET} - ${URL_COMPARE}/${TARGET_BRANCH}...${BASE_BRANCH} + ${URL_COMPARE}/${TARGET_BRANCH}...${BASE_BRANCH}?expand=1&title=version%20${VERSION} select ${COLOR_SELECT}Create a merge commit${COLOR_RESET} 5. Create a new release - ${URL_RELEASE} + ${URL_RELEASE}?tag=${TAG}&target=${TARGET_BRANCH}&title=${PACKAGE_NAME}%20${VERSION}%20released Tag version: ${COLOR_INPUT}${TAG}${COLOR_RESET} Target: ${COLOR_INPUT}${TARGET_BRANCH}${COLOR_RESET} Release title: ${COLOR_INPUT}${PACKAGE_NAME} ${VERSION} released${COLOR_RESET} diff --git a/scripts/prepare-release.sh b/scripts/prepare-release.sh new file mode 100755 index 0000000..a549057 --- /dev/null +++ b/scripts/prepare-release.sh @@ -0,0 +1,112 @@ +#!/bin/bash +# requires following packages: +# - git; I believe it's already installed. +# - sed; GNU sed is preferred. POSIX sed may not work. + +set -e + +COLOR_ERROR="\e[1;41m" +COLOR_SECTION="\e[1;34m" +COLOR_COMMAND_NAME="\e[1;34m" +COLOR_OPTION="\e[4;36m" +COLOR_COMMAND="\e[4m" +COLOR_FILE="\e[1;34m" +COLOR_BRANCH="\e[1;31m" +COLOR_INPUT="\e[1;31m" +COLOR_SELECT="\e[1;32m" +COLOR_RESET="\e[m" + +function main() { + if [ $# -lt 1 ]; then + usage + fi + + cd $(dirname ${0})/.. + + local VERSION=$1 + check_version_format ${VERSION} + + update_changelog ${VERSION} + update_package_version ${VERSION} + update_dependencies_version + regenerate_package_lock + build_package + commit_changes ${VERSION} +} + +function usage() { + local COMMAND=`basename ${0}` + + echo -e "${COLOR_SECTION}NAME${COLOR_RESET} + ${COMMAND} - Prepare for new release + +${COLOR_SECTION}SYNOPSIS${COLOR_RESET} + ${COLOR_COMMAND_NAME}${COMMAND}${COLOR_RESET} <${COLOR_OPTION}new-version${COLOR_RESET}> + +${COLOR_SECTION}DESCRIPTION${COLOR_RESET} + This command: + - updates ${COLOR_FILE}CHANGELOG.md${COLOR_RESET} + - updates package version in ${COLOR_FILE}package.json${COLOR_RESET} + - updates dependencies version in ${COLOR_FILE}package.json${COLOR_RESET} + - verifies + - ...and commits! + + ${COLOR_OPTION}new-version${COLOR_RESET} must follow \"Semantic Versioning\" . +" + exit 1 +} + +function check_version_format() { + if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then + return + fi + + echo -e "${COLOR_ERROR}ERROR:${COLOR_RESET} Follow \"Semantic Versioning\" for new version. +" >&2 + exit 2 +} + +function update_changelog() { + local VERSION=$1 + local DATE=`date "+%Y-%m-%d"` + local KEYWORD="Unreleased" + + sed -i".bak" -r \ + -e "s/^((##\s+)\[${KEYWORD}\])$/\1\n\n\2[${VERSION}] - ${DATE}/" \ + -e "s/^(\[${KEYWORD}\](.*))(v.*)\.\.\.HEAD$/\1v${VERSION}...HEAD\n[${VERSION}]\2\3...v${VERSION}/" \ + CHANGELOG.md +} + +function update_package_version() { + local VERSION=$1 + + sed -i".bak" -r \ + -e "s/(\"version\"\s*:\s*)\".*?\"/\1\"${VERSION}\"/" \ + package.json +} + +function update_dependencies_version() { + npm ci + npm run check-updates -- -u +} + +function regenerate_package_lock() { + rm -rf package-lock.json node_modules + npm install +} + +function build_package() { + npm run build + npm run verify +} + +function commit_changes() { + local VERSION=$1 + + rm -rf node_modules + npm ci --only=production + git add CHANGELOG.md package.json package-lock.json node_modules lib + git commit -m "version ${VERSION}" +} + +main "$@" diff --git a/src/main.ts b/src/main.ts index 48fbd44..97a0650 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ -import * as fs from "fs"; -import * as path from "path"; +import fs from "fs"; +import path from "path"; import * as core from "@actions/core";