-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
195 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
Oops, something went wrong.