From 5feac9938652761f1d2490e7ce3add00d4d6290e Mon Sep 17 00:00:00 2001 From: hrai <4055444+hrai@users.noreply.github.com> Date: Mon, 19 Oct 2020 17:40:04 +1100 Subject: [PATCH] Auto versioning (#44) --- .github/workflows/nodejs.yml | 2 +- .github/workflows/release.yml | 21 +++++++++ manifest.json | 2 +- package.json | 7 +++ yarn.lock | 80 ++++++++++++++++++++++++++++++++++- 5 files changed, 108 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b4337e7..a940eb2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [14.x] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94c770b..b77b790 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,3 +28,24 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} exclude: '^Meta|^Document|^Readme|^Lint' + + Build: + needs: Version + if: github.event_name == 'push' || needs.Version.outputs.created + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci + - uses: actions/setup-node@v1 + with: + node-version: 14 + - run: npm test + - name: Update extension’s meta + env: + VER: ${{ needs.Version.outputs.version }} + run: | + echo https://github.com/$GITHUB_REPOSITORY/tree/$VER > distribution/SOURCE_URL.txt + npm run version + - uses: actions/upload-artifact@v2 + with: + path: distribution diff --git a/manifest.json b/manifest.json index ded2874..6eb553e 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "description": "Firefox add-on to automatically capitalise the first letter of a sentence while typing.", "homepage_url": "https://github.com/hrai/auto-capitalise-sentence/", "manifest_version": 2, - "version": "2.17", + "version": "0.0.0", "browser_action": { "default_icon": "icons/auto-capitalise-sentence.png", "default_title": "Auto-capitalise sentence", diff --git a/package.json b/package.json index e58f0f5..55ddc59 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,10 @@ "test-watch": "jest --watch test/", "lint": "eslint .", "lint-fix": "eslint --fix .", + "version": "dot-json manifest.json version $VER", + "release": "VER=$(daily-version) run-s build version", + "release:amo": "web-ext-submit --source-dir distribution", + "release:cws": "webstore upload --source=distribution --auto-publish", "start:firefox": "web-ext run" }, "prettier": { @@ -28,11 +32,14 @@ "babel-jest": "^26.5.2", "babelify": "^10.0.0", "browserify": "^17.0.0", + "daily-version": "^2.0.0", + "dot-json": "^1.2.1", "eslint": "^7.11.0", "husky": "^4.3.0", "jest": "^24.9.0", "jquery": "^3.5.1", "lint-staged": "^10.4.0", + "npm-run-all": "^4.1.5", "sinon": "^7.5.0", "watchify": "^3.11.1", "web-ext": "^5.2.0", diff --git a/yarn.lock b/yarn.lock index 967957f..5e0942e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2305,7 +2305,7 @@ chalk@4.1.0, chalk@^4.0.0, chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2706,7 +2706,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -2775,6 +2775,13 @@ cssstyle@^1.0.0: dependencies: cssom "0.3.x" +daily-version@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/daily-version/-/daily-version-2.0.0.tgz#ccf32bfd120527b0febf64d26f17b636a5cd0bec" + integrity sha512-VwLGd9tLophN8vwgz7Ba3Ly0pkb6R8ZpcQ795W8VvU4+t2P3I85VEQONM/eZz3UTnpSjibuV8IuS7f68f61ofg== + dependencies: + utc-version "^2.0.1" + dash-ast@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/dash-ast/-/dash-ast-1.0.0.tgz#12029ba5fb2f8aa6f0a861795b23c1b4b6c27d37" @@ -2945,6 +2952,11 @@ des.js@^1.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" +detect-indent@~6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd" + integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA== + detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -2991,6 +3003,11 @@ dispensary@0.57.0: source-map-support "~0.5.4" yargs "~15.4.0" +docopt@~0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/docopt/-/docopt-0.6.2.tgz#b28e9e2220da5ec49f7ea5bb24a47787405eeb11" + integrity sha1-so6eIiDaXsSffqW7JKR3h0Be6xE= + doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -3059,6 +3076,15 @@ domutils@^1.5.1: dom-serializer "0" domelementtype "1" +dot-json@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/dot-json/-/dot-json-1.2.1.tgz#d32f67dd4e258711c786b3450bde427a9793c394" + integrity sha512-sHtCsDBBzhTUFhS12cAvUbP9JTr59LLNxnpNr6dlgbjZlN+nrWFs+uHXgsJvFmc5HoMFR4e60rdqd+GdSUlM3w== + dependencies: + detect-indent "~6.0.0" + docopt "~0.6.2" + underscore-keypath "~0.0.22" + dot-prop@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" @@ -5588,6 +5614,11 @@ mem@^5.0.0: mimic-fn "^2.1.0" p-is-promise "^2.1.0" +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -5895,6 +5926,21 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129" integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== +npm-run-all@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" + integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== + dependencies: + ansi-styles "^3.2.1" + chalk "^2.4.1" + cross-spawn "^6.0.5" + memorystream "^0.3.1" + minimatch "^3.0.4" + pidtree "^0.3.0" + read-pkg "^3.0.0" + shell-quote "^1.6.1" + string.prototype.padend "^3.0.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -6312,6 +6358,11 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +pidtree@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" + integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== + pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" @@ -7384,6 +7435,14 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string.prototype.padend@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.0.tgz#dc08f57a8010dc5c153550318f67e13adbb72ac3" + integrity sha512-3aIv8Ffdp8EZj8iLwREGpQaUZiPyrWrpzMBHvkiSW/bK/EGve9np07Vwy7IJ5waydpGXzQZu/F8Oze2/IWkBaA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + string.prototype.trimend@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" @@ -7790,6 +7849,18 @@ undeclared-identifiers@^1.1.2: simple-concat "^1.0.0" xtend "^4.0.1" +underscore-keypath@~0.0.22: + version "0.0.22" + resolved "https://registry.yarnpkg.com/underscore-keypath/-/underscore-keypath-0.0.22.tgz#48a528392bb6efc424be1caa56da4b5faccf264d" + integrity sha1-SKUoOSu278QkvhyqVtpLX6zPJk0= + dependencies: + underscore "*" + +underscore@*: + version "1.11.0" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.11.0.tgz#dd7c23a195db34267186044649870ff1bab5929e" + integrity sha512-xY96SsN3NA461qIRKZ/+qox37YXPtSBswMGfiNptr+wrt6ds4HaMw23TP612fEyGekRE6LNRiLYr/aqbHXNedw== + unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" @@ -7905,6 +7976,11 @@ use@^3.1.0: resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +utc-version@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/utc-version/-/utc-version-2.0.2.tgz#45afcec3eebf8a738c44bfe39cf9ca5a621c89ae" + integrity sha512-DblGt/1KFe3Jl1BbTZN7P8SFNw6L0zU/zahdgCJ+a/LPW6SE7VPY3RfpEg0W0ksyx6NewZYu7WD/7NzV7xljlA== + util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"