From 1fb0019928664fbd209dad79454d0dd6b408a039 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Mon, 21 Aug 2023 16:28:54 +0100 Subject: [PATCH] Add WIP pre-release workflow --- .github/workflows/bump-version.mjs | 44 +++++++ .github/workflows/pre-release.yml | 38 ++++++ package-lock.json | 180 ++++++++++++++++++----------- package.json | 1 + 4 files changed, 195 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/bump-version.mjs create mode 100644 .github/workflows/pre-release.yml diff --git a/.github/workflows/bump-version.mjs b/.github/workflows/bump-version.mjs new file mode 100644 index 0000000..e1cf2f4 --- /dev/null +++ b/.github/workflows/bump-version.mjs @@ -0,0 +1,44 @@ +import latestSemver from 'latest-semver' +import * as fs from 'fs/promises' +import assert from 'assert' + +async function bumpVersion() { + let res = await fetch( + 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery', + { + method: 'POST', + headers: { + accept: 'application/json;api-version=7.2-preview.1;excludeUrls=true', + 'content-type': 'application/json', + }, + body: JSON.stringify({ + assetTypes: null, + flags: 2151, + filters: [ + { + criteria: [{ filterType: 7, value: 'bradlc.vscode-tailwindcss' }], + direction: 2, + pageSize: 100, + pageNumber: 1, + sortBy: 0, + sortOrder: 0, + pagingToken: null, + }, + ], + }), + } + ) + let { results } = await res.json() + let versions = results[0].extensions[0].versions.map(({ version }) => version) + let latest = latestSemver(versions) + let parts = latest.split('.') + + assert(Number(parts[1]) % 2 === 1) + + let nextVersion = `${parts[0]}.${parts[1]}.${Number(parts[2]) + 1}` + let pkgFilename = 'packages/vscode-tailwindcss/package.json' + let pkg = JSON.parse(await fs.readFile(pkgFilename, 'utf8')) + await fs.writeFile(pkgFilename, JSON.stringify({ ...pkg, version: nextVersion }, null, 2), 'utf8') +} + +bumpVersion() diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 0000000..a355575 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,38 @@ +name: Publish pre-release +concurrency: publish +on: + push: + branches: [master] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm install && npm run bootstrap + - name: Bump version + run: > + node .github/workflows/bump-version.mjs && + cat packages/vscode-tailwindcss/package.json + # - name: Publish + # env: + # VSCODE_TOKEN: ${{ secrets.VSCODE_TOKEN }} + # run: npx lerna run publish --scope=vscode-tailwindcss -- --pre-release -p $VSCODE_TOKEN + - name: Build LSP + run: npx lerna run build --scope=tailwindcss-language-server + - name: Resolve LSP version + run: | + echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + - name: 'Version LSP based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}' + run: > + cd packages/tailwindcss-language-server && + npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version + - name: Publish LSP + run: > + cd packages/tailwindcss-language-server && + npm publish --tag insiders + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 702217c..61709dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,6 +71,7 @@ }, "devDependencies": { "esbuild": "0.14.11", + "latest-semver": "^4.0.0", "lerna": "^3.22.1", "mri": "1.2.0" } @@ -6403,9 +6404,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001521", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001521.tgz", - "integrity": "sha512-fnx1grfpEOvDGH+V17eccmNjucGUnCbP6KL+l5KqBIerp26WK/+RQ7CIDE37KGJjaPyqWXXlFUyKiWmvdNNKmQ==", + "version": "1.0.30001522", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001522.tgz", + "integrity": "sha512-TKiyTVZxJGhsTszLuzb+6vUZSjVOAhClszBr2Ta2k9IwtNBT/4dzmL6aywt0HCgEZlmwJzXJd8yNiob6HgwTRg==", "funding": [ { "type": "opencollective", @@ -6643,6 +6644,18 @@ "node": ">=0.10.0" } }, + "node_modules/clean-semver": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clean-semver/-/clean-semver-2.1.0.tgz", + "integrity": "sha512-a5sIRLwP078fc3/AEDfSxD8GmMBJlxYCUnRfXjldyy9RjwXxNVuK9hLwDar4sceJhZp6G+66ukNZsVFIqN28jg==", + "dev": true, + "dependencies": { + "semver": "^7.3.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", @@ -7462,11 +7475,11 @@ } }, "node_modules/core-js-compat": { - "version": "3.32.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.0.tgz", - "integrity": "sha512-7a9a3D1k4UCVKnLhrgALyFcP7YCsLOQIxPd0dKjf/6GuPcgyiGP70ewWdCGrSK7evyhymi0qO4EqCmSJofDeYw==", + "version": "3.32.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.1.tgz", + "integrity": "sha512-GSvKDv4wE0bPnQtjklV101juQ85g6H3rm5PDP20mqlS5j0kXF3pP97YvAu5hl+uFHqMictp3b2VxOHljWMAtuA==", "dependencies": { - "browserslist": "^4.21.9" + "browserslist": "^4.21.10" }, "funding": { "type": "opencollective", @@ -8040,9 +8053,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.493", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.493.tgz", - "integrity": "sha512-T1k9mhYPdjnmS4VAz4J1oKVn6/M6LxoqQEVtYRL0swJVj73bA2NzqF0HjwxGsW3zL3ir0oPmLfd7lyi/RYzreg==" + "version": "1.4.496", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz", + "integrity": "sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==" }, "node_modules/emoji-regex": { "version": "9.2.2", @@ -8744,9 +8757,9 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.28.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.0.tgz", - "integrity": "sha512-B8s/n+ZluN7sxj9eUf7/pRFERX0r5bnFA2dCaLHy2ZeaQEAz0k+ZZkFWRFHJAqxfxQDx6KLv9LeIki7cFdwW+Q==", + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", "dependencies": { "array-includes": "^3.1.6", "array.prototype.findlastindex": "^1.2.2", @@ -8757,13 +8770,12 @@ "eslint-import-resolver-node": "^0.3.7", "eslint-module-utils": "^2.8.0", "has": "^1.0.3", - "is-core-module": "^2.12.1", + "is-core-module": "^2.13.0", "is-glob": "^4.0.3", "minimatch": "^3.1.2", "object.fromentries": "^2.0.6", "object.groupby": "^1.0.0", "object.values": "^1.1.6", - "resolve": "^1.22.3", "semver": "^6.3.1", "tsconfig-paths": "^3.14.2" }, @@ -8805,22 +8817,6 @@ "node": "*" } }, - "node_modules/eslint-plugin-import/node_modules/resolve": { - "version": "1.22.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", - "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/eslint-plugin-import/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -14200,9 +14196,9 @@ } }, "node_modules/jiti": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.1.tgz", - "integrity": "sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==", + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.3.tgz", + "integrity": "sha512-5eEbBDQT/jF1xg6l36P+mWGGoH9Spuy0PCdSr2dtWRDGC6ph/w9ZCL4lmESW8f8F7MwT3XKescfP0wnZWAKL9w==", "bin": { "jiti": "bin/jiti.js" } @@ -14444,6 +14440,21 @@ "language-subtag-registry": "~0.3.2" } }, + "node_modules/latest-semver": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/latest-semver/-/latest-semver-4.0.0.tgz", + "integrity": "sha512-flUamL125jFTL9xLuEI/hvzdMhBGCUOwqT3Y2km3fyDiiEFaEnlfwiuxUvQ7BhHdwXWLrqXTytX3UNNd095kxA==", + "dev": true, + "dependencies": { + "to-semver": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lerna": { "version": "3.22.1", "resolved": "https://registry.npmjs.org/lerna/-/lerna-3.22.1.tgz", @@ -15667,9 +15678,9 @@ } }, "node_modules/node-abi": { - "version": "3.46.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.46.0.tgz", - "integrity": "sha512-LXvP3AqTIrtvH/jllXjkNVbYifpRbt9ThTtymSMSuHmhugQLAWr99QQFTm+ZRht9ziUvdGOgB+esme1C6iE6Lg==", + "version": "3.47.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz", + "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==", "dependencies": { "semver": "^7.3.5" }, @@ -20499,6 +20510,22 @@ "node": ">=8.0" } }, + "node_modules/to-semver": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/to-semver/-/to-semver-4.0.0.tgz", + "integrity": "sha512-qARDZe0teB+/7EXkXE2cWnQddhLzunD72n+LGvSOHvti21kk9YHUSOjJpWDTLJ44MP7VNWFzo5n10PUwr2r3zA==", + "dev": true, + "dependencies": { + "clean-semver": "^2.1.0", + "semver": "^7.3.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tough-cookie": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", @@ -27084,9 +27111,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001521", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001521.tgz", - "integrity": "sha512-fnx1grfpEOvDGH+V17eccmNjucGUnCbP6KL+l5KqBIerp26WK/+RQ7CIDE37KGJjaPyqWXXlFUyKiWmvdNNKmQ==" + "version": "1.0.30001522", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001522.tgz", + "integrity": "sha512-TKiyTVZxJGhsTszLuzb+6vUZSjVOAhClszBr2Ta2k9IwtNBT/4dzmL6aywt0HCgEZlmwJzXJd8yNiob6HgwTRg==" }, "capture-exit": { "version": "2.0.0", @@ -27264,6 +27291,15 @@ } } }, + "clean-semver": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clean-semver/-/clean-semver-2.1.0.tgz", + "integrity": "sha512-a5sIRLwP078fc3/AEDfSxD8GmMBJlxYCUnRfXjldyy9RjwXxNVuK9hLwDar4sceJhZp6G+66ukNZsVFIqN28jg==", + "dev": true, + "requires": { + "semver": "^7.3.2" + } + }, "cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", @@ -27911,11 +27947,11 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, "core-js-compat": { - "version": "3.32.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.0.tgz", - "integrity": "sha512-7a9a3D1k4UCVKnLhrgALyFcP7YCsLOQIxPd0dKjf/6GuPcgyiGP70ewWdCGrSK7evyhymi0qO4EqCmSJofDeYw==", + "version": "3.32.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.1.tgz", + "integrity": "sha512-GSvKDv4wE0bPnQtjklV101juQ85g6H3rm5PDP20mqlS5j0kXF3pP97YvAu5hl+uFHqMictp3b2VxOHljWMAtuA==", "requires": { - "browserslist": "^4.21.9" + "browserslist": "^4.21.10" } }, "core-util-is": { @@ -28362,9 +28398,9 @@ } }, "electron-to-chromium": { - "version": "1.4.493", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.493.tgz", - "integrity": "sha512-T1k9mhYPdjnmS4VAz4J1oKVn6/M6LxoqQEVtYRL0swJVj73bA2NzqF0HjwxGsW3zL3ir0oPmLfd7lyi/RYzreg==" + "version": "1.4.496", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz", + "integrity": "sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==" }, "emoji-regex": { "version": "9.2.2", @@ -29112,9 +29148,9 @@ } }, "eslint-plugin-import": { - "version": "2.28.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.0.tgz", - "integrity": "sha512-B8s/n+ZluN7sxj9eUf7/pRFERX0r5bnFA2dCaLHy2ZeaQEAz0k+ZZkFWRFHJAqxfxQDx6KLv9LeIki7cFdwW+Q==", + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", "requires": { "array-includes": "^3.1.6", "array.prototype.findlastindex": "^1.2.2", @@ -29125,13 +29161,12 @@ "eslint-import-resolver-node": "^0.3.7", "eslint-module-utils": "^2.8.0", "has": "^1.0.3", - "is-core-module": "^2.12.1", + "is-core-module": "^2.13.0", "is-glob": "^4.0.3", "minimatch": "^3.1.2", "object.fromentries": "^2.0.6", "object.groupby": "^1.0.0", "object.values": "^1.1.6", - "resolve": "^1.22.3", "semver": "^6.3.1", "tsconfig-paths": "^3.14.2" }, @@ -29161,16 +29196,6 @@ "brace-expansion": "^1.1.7" } }, - "resolve": { - "version": "1.22.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", - "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", - "requires": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -33053,9 +33078,9 @@ } }, "jiti": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.1.tgz", - "integrity": "sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==" + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.3.tgz", + "integrity": "sha512-5eEbBDQT/jF1xg6l36P+mWGGoH9Spuy0PCdSr2dtWRDGC6ph/w9ZCL4lmESW8f8F7MwT3XKescfP0wnZWAKL9w==" }, "jpjs": { "version": "1.2.1", @@ -33245,6 +33270,15 @@ "language-subtag-registry": "~0.3.2" } }, + "latest-semver": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/latest-semver/-/latest-semver-4.0.0.tgz", + "integrity": "sha512-flUamL125jFTL9xLuEI/hvzdMhBGCUOwqT3Y2km3fyDiiEFaEnlfwiuxUvQ7BhHdwXWLrqXTytX3UNNd095kxA==", + "dev": true, + "requires": { + "to-semver": "^4.0.0" + } + }, "lerna": { "version": "3.22.1", "resolved": "https://registry.npmjs.org/lerna/-/lerna-3.22.1.tgz", @@ -34237,9 +34271,9 @@ } }, "node-abi": { - "version": "3.46.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.46.0.tgz", - "integrity": "sha512-LXvP3AqTIrtvH/jllXjkNVbYifpRbt9ThTtymSMSuHmhugQLAWr99QQFTm+ZRht9ziUvdGOgB+esme1C6iE6Lg==", + "version": "3.47.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz", + "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==", "requires": { "semver": "^7.3.5" } @@ -37936,6 +37970,16 @@ "is-number": "^7.0.0" } }, + "to-semver": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/to-semver/-/to-semver-4.0.0.tgz", + "integrity": "sha512-qARDZe0teB+/7EXkXE2cWnQddhLzunD72n+LGvSOHvti21kk9YHUSOjJpWDTLJ44MP7VNWFzo5n10PUwr2r3zA==", + "dev": true, + "requires": { + "clean-semver": "^2.1.0", + "semver": "^7.3.5" + } + }, "tough-cookie": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", diff --git a/package.json b/package.json index 3213227..ca4979b 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ }, "devDependencies": { "esbuild": "0.14.11", + "latest-semver": "^4.0.0", "lerna": "^3.22.1", "mri": "1.2.0" }