Skip to content

Commit ceb6192

Browse files
CI workflow to publish extensions
1 parent a049d34 commit ceb6192

File tree

7 files changed

+144
-23
lines changed

7 files changed

+144
-23
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Set Version from Branch'
2+
description: 'Sets VERSION environment variable from the current branch name'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Set version from branch name
8+
shell: bash
9+
run: |
10+
# GITHUB_HEAD_REF contains the source branch for PRs (e.g., "v1.2.5"), but is empty for pushes
11+
# GITHUB_REF_NAME contains the merge ref for PRs (e.g., "1/merge"), but the branch name for pushes
12+
# Prefer GITHUB_HEAD_REF when available to get the actual branch name
13+
if [ -n "$GITHUB_HEAD_REF" ]; then
14+
BRANCH_NAME="$GITHUB_HEAD_REF"
15+
else
16+
BRANCH_NAME="$GITHUB_REF_NAME"
17+
fi
18+
# Strip leading 'v' if present
19+
VERSION="${BRANCH_NAME#v}"
20+
21+
# Get version from package.json
22+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
23+
24+
# Verify versions match
25+
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
26+
echo "Error: Version mismatch!"
27+
echo " Branch version: $VERSION"
28+
echo " package.json version: $PACKAGE_VERSION"
29+
echo "Please ensure the branch name matches the version in package.json"
30+
exit 1
31+
fi
32+
33+
echo "VERSION=$VERSION" >> $GITHUB_ENV
34+
echo "Using version: $VERSION (from branch: $BRANCH_NAME)"

.github/workflows/build.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ jobs:
2424
- name: Install dependencies
2525
run: npm ci
2626

27-
- name: Format
28-
run: npx biome ci .
29-
3027
- name: Lint
31-
run: npx eslint
28+
run: make lint
3229

3330
test:
3431
name: Test
@@ -46,14 +43,8 @@ jobs:
4643
- name: Install dependencies
4744
run: npm ci
4845

49-
- name: Type check
50-
run: npx tsc
51-
52-
- name: Compile
53-
run: npx vsce package
46+
- name: Test
47+
run: make test
5448
env:
5549
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode
5650
NODE_ENV: ci
57-
58-
- name: Test
59-
run: xvfb-run -a npx vscode-test

.github/workflows/publish-ovsx.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to Open VSX
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
name: Publish to Open VSX
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Set version from branch name
27+
uses: ./.github/actions/set-version
28+
29+
- name: Publish to Open VSX
30+
run: make publish-ovsx
31+
env:
32+
VERSION: ${{ env.VERSION }}
33+
OVSX_PAT: ${{ secrets.OVSX_PAT }}
34+
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode
35+
NODE_ENV: production
36+
ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to Visual Studio Marketplace
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
name: Publish to VS Marketplace
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Set version from branch name
27+
uses: ./.github/actions/set-version
28+
29+
- name: Publish to VS Marketplace
30+
run: make publish-marketplace
31+
env:
32+
VERSION: ${{ env.VERSION }}
33+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
34+
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode
35+
NODE_ENV: production
36+
ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.2.5 (2025-11-05) (pre-release)
4+
5+
- chore: Testing publishing from Github action
6+
37
## 1.2.4 (2025-10-13)
48

59
- chore: Update dependencies
@@ -77,4 +81,4 @@ Initial preview release.
7781

7882
- Add feature deploy Lambda to LocalStack
7983
- Add feature invoke Lambda in LocalStack
80-
- Add Python CodeLens for triggering deploy and invoke commands
84+
- Add Python CodeLens for triggering deploy and invoke commands

Makefile

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
.PHONY: vsix publish
1+
.PHONY: publish-ovsx publish-marketplace lint test
22

3-
vsix:
4-
@echo "Packaging VS Code extension into VSIX file..."
5-
LOCALSTACK_WEB_AUTH_REDIRECT=https://app.localstack.cloud/redirect?name=VSCode NODE_ENV=production ANALYTICS_API_URL=https://analytics.localstack.cloud/v1/events npx vsce package
6-
@hash=$$(git rev-parse --short HEAD); \
7-
mv localstack-1.0.0.vsix localstack-1.0.0-$$hash.vsix
3+
# VERSION can be set via environment variable or defaults to the version in package.json
4+
VERSION ?= $(shell node -p "require('./package.json').version")
5+
6+
lint:
7+
@echo "Running format check..."
8+
npx biome ci .
9+
@echo "Running linter..."
10+
npx eslint
11+
12+
test:
13+
@echo "Running type check..."
14+
npx tsc
15+
@echo "Compiling extension..."
16+
npx vsce package
17+
@echo "Running tests..."
18+
xvfb-run -a npx vscode-test
19+
20+
publish-marketplace:
21+
@echo "Publishing VS Code extension to VS Marketplace..."
22+
@echo "Verifying PAT..."
23+
npx vsce verify-pat localstack -p $(VSCE_PAT)
24+
npx vsce publish $(VERSION) -p $(VSCE_PAT) --no-update-package-json
25+
26+
publish-ovsx:
27+
@echo "Publishing VS Code extension to Open VSX..."
28+
@echo "Verifying PAT..."
29+
npx ovsx verify-pat localstack -p $(OVSX_PAT)
30+
npx ovsx publish --packageVersion $(VERSION) -p $(OVSX_PAT)
831

9-
publish:
10-
@echo "Publishing VS Code extension..."
11-
LOCALSTACK_WEB_AUTH_REDIRECT=https://app.localstack.cloud/redirect?name=VSCode NODE_ENV=production ANALYTICS_API_URL=https://analytics.localstack.cloud/v1/events npx vsce publish

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "LocalStack",
44
"displayName": "LocalStack Toolkit",
55
"description": "LocalStack - Run locally, deploy globally!",
6-
"version": "1.2.4",
6+
"version": "1.2.5",
77
"engines": {
88
"node": ">=20",
99
"vscode": "^1.83.0"

0 commit comments

Comments
 (0)