Skip to content

Commit a281ab1

Browse files
rcosta358codex
andcommitted
Merge branch 'codex/review-stack-140' into codex/review-stack-142
Co-authored-by: Codex <noreply@openai.com>
2 parents d9d368f + bc544ca commit a281ab1

8 files changed

Lines changed: 124 additions & 62 deletions

File tree

‎.devcontainer/devcontainer.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Latte Extension Dev",
3-
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
3+
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
44
"customizations": {
55
"vscode": {
66
"extensions": [
@@ -16,4 +16,3 @@
1616
},
1717
"postCreateCommand": "npm install"
1818
}
19-

‎.github/workflows/publish.yml‎

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,29 @@ on:
66
- 'v*'
77

88
jobs:
9+
checks:
10+
uses: ./.github/workflows/test.yml
11+
912
publish:
13+
needs: checks
1014
runs-on: ubuntu-latest
1115

1216
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
16-
- name: Setup Java
17-
uses: actions/setup-java@v4
17+
- name: Download checked extension
18+
uses: actions/download-artifact@v4
1819
with:
19-
java-version: 20
20-
distribution: temurin
20+
name: liquid-java-vsix
2121

2222
- name: Setup Node.js
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: 22
2626

27-
- name: Build Server JAR
28-
working-directory: ./server
29-
run: |
30-
mvn -B -ntp clean package -DskipTests
31-
mkdir -p ../client/server
32-
cp target/language-server-liquidjava.jar ../client/server/
33-
34-
- name: Install dependencies and build
35-
working-directory: ./client
36-
run: |
37-
npm install
38-
npm run package
39-
4027
- name: Install vsce
4128
run: npm install -g @vscode/vsce
4229

43-
- name: Package extension
44-
working-directory: ./client
45-
run: vsce package --no-dependencies --out liquid-java.vsix
46-
4730
- name: Publish to VS Code Marketplace
48-
working-directory: ./client
4931
run: vsce publish --packagePath liquid-java.vsix -p ${{ secrets.VSCE_TOKEN }}
5032

5133
- name: Publish to Open VSX Marketplace
52-
working-directory: ./client
5334
run: npx ovsx publish liquid-java.vsix --pat ${{ secrets.OVSX_TOKEN }}

‎.github/workflows/test.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test
22

33
on:
44
push:
5-
branches: ['**']
5+
branches: [main]
66
pull_request:
77
workflow_call:
88

@@ -16,7 +16,6 @@ permissions:
1616
jobs:
1717
checks:
1818
name: Checks
19-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
2019
runs-on: ubuntu-latest
2120

2221
defaults:
@@ -70,3 +69,11 @@ jobs:
7069
unzip -Z1 liquid-java.vsix > /tmp/liquid-java-vsix-files.txt
7170
grep -Fx 'extension/dist/server/language-server-liquidjava.jar' /tmp/liquid-java-vsix-files.txt
7271
grep -Fx 'extension/media/webview.js' /tmp/liquid-java-vsix-files.txt
72+
73+
- name: Upload checked extension
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: liquid-java-vsix
77+
path: client/liquid-java.vsix
78+
if-no-files-found: error
79+
retention-days: 1

‎CONTRIBUTING.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,26 @@ Use `./install.sh --skip-server` to package and install the extension without re
3232

3333
### Releasing
3434

35-
To create and push a git tag that will trigger the GitHub Actions workflow that automatically publishes the extension in both the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=AlcidesFonseca.liquid-java) and the [Open VSX Registry](https://open-vsx.org/extension/AlcidesFonseca/liquid-java), run the release script from the repository root:
35+
Create a version bump pull request from `main` with the release script:
3636

3737
```bash
3838
./release.sh
3939
```
4040

41-
By default, the script bumps the patch version in [client/package.json](./client/package.json).
42-
To release a manually bumped version instead, pass the version explicitly; it must match the version in [client/package.json](./client/package.json):
41+
By default, this bumps the patch version in [client/package.json](./client/package.json). Pass a version to set it explicitly:
4342

4443
```bash
4544
./release.sh <new-version>
4645
```
4746

47+
After the pull request passes Checks and is merged, create and push its release tag from `main`:
48+
49+
```bash
50+
./release.sh --tag <new-version>
51+
```
52+
53+
The tag runs Checks again and publishes the verified extension artifact to the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=AlcidesFonseca.liquid-java) and the [Open VSX Registry](https://open-vsx.org/extension/AlcidesFonseca/liquid-java).
54+
4855
### Development Mode
4956

5057
To run the extension in development mode, follow these steps:

‎client/package-lock.json‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"homepage": "https://liquid-java.github.io",
1212
"engines": {
13+
"node": ">=22",
1314
"vscode": "^1.82.0"
1415
},
1516
"languages": [

‎release.sh‎

Lines changed: 94 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,113 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
VERSION=$1
3+
set -euo pipefail
44

5-
# check valid version format
6-
if [ -n "$VERSION" ] && [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
7-
echo "Version must be in format 1.2.3"
5+
usage() {
6+
echo "Usage: ./release.sh [VERSION] | ./release.sh --tag VERSION" >&2
7+
}
8+
9+
MODE="pr"
10+
if [[ "${1:-}" == "--tag" ]]; then
11+
MODE="tag"
12+
shift
13+
fi
14+
15+
if [[ $# -gt 1 ]] || [[ "$MODE" == "tag" && $# -ne 1 ]]; then
16+
usage
17+
exit 1
18+
fi
19+
20+
VERSION="${1:-}"
21+
if [[ -n "$VERSION" && ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
22+
echo "Version must be in format 1.2.3" >&2
823
exit 1
924
fi
1025

11-
# check current branch
1226
CURRENT_BRANCH=$(git branch --show-current)
13-
if [ "$CURRENT_BRANCH" != "main" ]; then
14-
echo "Releases can only be created from the main branch (current: $CURRENT_BRANCH)"
27+
if [[ "$CURRENT_BRANCH" != "main" ]]; then
28+
echo "Releases must start from main (current: $CURRENT_BRANCH)" >&2
1529
exit 1
1630
fi
1731

18-
# bump patch version if no version provided
19-
if [ -z "$VERSION" ]; then
20-
(cd client && npm version patch --no-git-tag-version)
21-
VERSION=$(node -p "require('./client/package.json').version")
32+
if [[ -n "$(git status --porcelain)" ]]; then
33+
echo "Releases require a clean working tree" >&2
34+
exit 1
2235
fi
2336

24-
# check if version present in package.json
25-
if ! grep -q "\"version\": \"$VERSION\"" ./client/package.json; then
26-
echo "Version $VERSION not found in package.json"
37+
git pull --ff-only origin main
38+
if [[ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]]; then
39+
echo "Local main must match origin/main before releasing" >&2
2740
exit 1
2841
fi
2942

30-
# check if version tag already exists
31-
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
32-
echo "Release $VERSION already exists"
43+
if [[ "$MODE" == "tag" ]]; then
44+
CURRENT_VERSION=$(node -p "require('./client/package.json').version")
45+
if [[ "$CURRENT_VERSION" != "$VERSION" ]]; then
46+
echo "Version $VERSION is not the version on main ($CURRENT_VERSION)" >&2
47+
exit 1
48+
fi
49+
50+
if git rev-parse --quiet --verify "refs/tags/v$VERSION" >/dev/null; then
51+
echo "Release $VERSION already exists" >&2
52+
exit 1
53+
fi
54+
REMOTE_TAG=$(git ls-remote --tags origin "refs/tags/v$VERSION")
55+
if [[ -n "$REMOTE_TAG" ]]; then
56+
echo "Release $VERSION already exists" >&2
57+
exit 1
58+
fi
59+
60+
git tag -a "v$VERSION" origin/main -m "vscode-liquidjava $VERSION"
61+
git push origin "refs/tags/v$VERSION"
62+
exit 0
63+
fi
64+
65+
if ! command -v gh >/dev/null 2>&1; then
66+
echo "GitHub CLI (gh) is required to create the release pull request" >&2
3367
exit 1
3468
fi
3569

36-
git pull
37-
git add .
70+
if [[ -z "$VERSION" ]]; then
71+
VERSION=$(node -e 'const [major, minor, patch] = require("./client/package.json").version.split(".").map(Number); console.log(`${major}.${minor}.${patch + 1}`)')
72+
fi
73+
74+
CURRENT_VERSION=$(node -p "require('./client/package.json').version")
75+
if [[ "$CURRENT_VERSION" == "$VERSION" ]]; then
76+
echo "Version $VERSION is already on main; choose a new version" >&2
77+
exit 1
78+
fi
79+
80+
BRANCH="codex/release-$VERSION"
81+
if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
82+
echo "Release branch $BRANCH already exists" >&2
83+
exit 1
84+
fi
85+
REMOTE_BRANCH=$(git ls-remote --heads origin "refs/heads/$BRANCH")
86+
if [[ -n "$REMOTE_BRANCH" ]]; then
87+
echo "Release branch $BRANCH already exists" >&2
88+
exit 1
89+
fi
90+
91+
if git rev-parse --quiet --verify "refs/tags/v$VERSION" >/dev/null; then
92+
echo "Release $VERSION already exists" >&2
93+
exit 1
94+
fi
95+
REMOTE_TAG=$(git ls-remote --tags origin "refs/tags/v$VERSION")
96+
if [[ -n "$REMOTE_TAG" ]]; then
97+
echo "Release $VERSION already exists" >&2
98+
exit 1
99+
fi
100+
101+
git switch -c "$BRANCH"
102+
(cd client && npm version "$VERSION" --no-git-tag-version >/dev/null)
103+
git add client/package.json client/package-lock.json
38104
git commit -m "Release $VERSION"
39-
git tag -a "v$VERSION" -m "vscode-liquidjava $VERSION"
105+
git push --set-upstream origin "$BRANCH"
106+
107+
gh pr create \
108+
--base main \
109+
--head "$BRANCH" \
110+
--title "Release $VERSION" \
111+
--body "Prepare version $VERSION for release. Merge this pull request after Checks pass, then run ./release.sh --tag $VERSION from main to publish."
40112

41-
git push
42-
git push --tags
113+
printf 'After the release pull request is merged, run ./release.sh --tag %s from main to publish.\n' "$VERSION"

‎server/pom.xml‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
<groupId>org.apache.maven.plugins</groupId>
3737
<artifactId>maven-compiler-plugin</artifactId>
3838
<version>${pVersion.compiler}</version>
39-
<configuration>
40-
<source>20</source>
41-
<target>20</target>
42-
</configuration>
4339
</plugin>
4440
<plugin>
4541
<groupId>org.apache.maven.plugins</groupId>
@@ -102,8 +98,7 @@
10298
<properties>
10399
<lsp4j.version>0.24.0</lsp4j.version>
104100
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
105-
<maven.compiler.source>20</maven.compiler.source>
106-
<maven.compiler.target>20</maven.compiler.target>
101+
<maven.compiler.release>20</maven.compiler.release>
107102
<!-- versions -->
108103
<version.memcompiler>1.3.0</version.memcompiler>
109104
<version.spoon>10.4.2</version.spoon>

0 commit comments

Comments
 (0)