Skip to content

Commit 1fb0019

Browse files
committed
Add WIP pre-release workflow
1 parent 4c702ac commit 1fb0019

File tree

4 files changed

+195
-68
lines changed

4 files changed

+195
-68
lines changed

.github/workflows/bump-version.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import latestSemver from 'latest-semver'
2+
import * as fs from 'fs/promises'
3+
import assert from 'assert'
4+
5+
async function bumpVersion() {
6+
let res = await fetch(
7+
'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery',
8+
{
9+
method: 'POST',
10+
headers: {
11+
accept: 'application/json;api-version=7.2-preview.1;excludeUrls=true',
12+
'content-type': 'application/json',
13+
},
14+
body: JSON.stringify({
15+
assetTypes: null,
16+
flags: 2151,
17+
filters: [
18+
{
19+
criteria: [{ filterType: 7, value: 'bradlc.vscode-tailwindcss' }],
20+
direction: 2,
21+
pageSize: 100,
22+
pageNumber: 1,
23+
sortBy: 0,
24+
sortOrder: 0,
25+
pagingToken: null,
26+
},
27+
],
28+
}),
29+
}
30+
)
31+
let { results } = await res.json()
32+
let versions = results[0].extensions[0].versions.map(({ version }) => version)
33+
let latest = latestSemver(versions)
34+
let parts = latest.split('.')
35+
36+
assert(Number(parts[1]) % 2 === 1)
37+
38+
let nextVersion = `${parts[0]}.${parts[1]}.${Number(parts[2]) + 1}`
39+
let pkgFilename = 'packages/vscode-tailwindcss/package.json'
40+
let pkg = JSON.parse(await fs.readFile(pkgFilename, 'utf8'))
41+
await fs.writeFile(pkgFilename, JSON.stringify({ ...pkg, version: nextVersion }, null, 2), 'utf8')
42+
}
43+
44+
bumpVersion()

.github/workflows/pre-release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish pre-release
2+
concurrency: publish
3+
on:
4+
push:
5+
branches: [master]
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: 18
14+
- name: Install dependencies
15+
run: npm install && npm run bootstrap
16+
- name: Bump version
17+
run: >
18+
node .github/workflows/bump-version.mjs &&
19+
cat packages/vscode-tailwindcss/package.json
20+
# - name: Publish
21+
# env:
22+
# VSCODE_TOKEN: ${{ secrets.VSCODE_TOKEN }}
23+
# run: npx lerna run publish --scope=vscode-tailwindcss -- --pre-release -p $VSCODE_TOKEN
24+
- name: Build LSP
25+
run: npx lerna run build --scope=tailwindcss-language-server
26+
- name: Resolve LSP version
27+
run: |
28+
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
29+
- name: 'Version LSP based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}'
30+
run: >
31+
cd packages/tailwindcss-language-server &&
32+
npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version
33+
- name: Publish LSP
34+
run: >
35+
cd packages/tailwindcss-language-server &&
36+
npm publish --tag insiders
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)