Skip to content
Closed
19 changes: 19 additions & 0 deletions .github/actions/build-vsix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Build VSIX Package'
description: 'Builds the VS Code extension VSIX package'

inputs:
version:
description: 'Version to build'
required: true

runs:
using: composite
steps:
- name: Build VSIX package
shell: bash
run: make vsix
env:
VERSION: ${{ inputs.version }}
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode
NODE_ENV: production
ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events
17 changes: 17 additions & 0 deletions .github/actions/set-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Set Version from Branch'
description: 'Sets VERSION environment variable from the current branch name'

runs:
using: composite
steps:
- name: Set version from branch name
shell: bash
run: |
# Use GITHUB_HEAD_REF for PRs, GITHUB_REF_NAME for direct pushes
if [ -n "$GITHUB_HEAD_REF" ]; then
BRANCH_NAME="$GITHUB_HEAD_REF"
else
BRANCH_NAME="$GITHUB_REF_NAME"
fi
echo "VERSION=$BRANCH_NAME" >> $GITHUB_ENV
echo "Using version: $BRANCH_NAME"
15 changes: 3 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Format
run: npx biome ci .

- name: Lint
run: npx eslint
run: make lint

test:
name: Test
Expand All @@ -46,14 +43,8 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Type check
run: npx tsc

- name: Compile
run: npx vsce package
- name: Test
run: make test
env:
LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode
NODE_ENV: ci

- name: Test
run: xvfb-run -a npx vscode-test
38 changes: 38 additions & 0 deletions .github/workflows/publish-ovsx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish to Open VSX

on:
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: Publish to Open VSX
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Node
uses: actions/setup-node@v4
with:
cache: npm

- name: Install dependencies
run: npm ci

- name: Set version from branch name
uses: ./.github/actions/set-version

- name: Build VSIX package
uses: ./.github/actions/build-vsix
with:
version: ${{ env.VERSION }}

- name: Publish to Open VSX
run: make publish-ovsx
env:
VERSION: ${{ env.VERSION }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
38 changes: 38 additions & 0 deletions .github/workflows/publish-vs-marketplace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish to Visual Studio Marketplace

on:
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: Publish to VS Marketplace
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Node
uses: actions/setup-node@v4
with:
cache: npm

- name: Install dependencies
run: npm ci

- name: Set version from branch name
uses: ./.github/actions/set-version

- name: Build VSIX package
uses: ./.github/actions/build-vsix
with:
version: ${{ env.VERSION }}

- name: Publish to VS Marketplace
run: make publish-marketplace
env:
VERSION: ${{ env.VERSION }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
42 changes: 33 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
.PHONY: vsix publish
.PHONY: vsix publish publish-ovsx publish-marketplace lint test

# VERSION can be set via environment variable or defaults to the version in package.json
VERSION ?= $(shell node -p "require('./package.json').version")

lint:
@echo "Running format check..."
npx biome ci .
@echo "Running linter..."
npx eslint

test:
@echo "Running type check..."
npx tsc
@echo "Compiling extension..."
npx vsce package
@echo "Running tests..."
xvfb-run -a npx vscode-test

vsix:
@echo "Packaging VS Code extension into VSIX file..."
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
@hash=$$(git rev-parse --short HEAD); \
mv localstack-1.0.0.vsix localstack-1.0.0-$$hash.vsix

publish:
@echo "Publishing VS Code extension..."
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
@echo "Packaging VS Code extension into VSIX file (version: $(VERSION))..."
npx vsce package $(VERSION) --no-update-package-json
@echo "Created: localstack-$(VERSION).vsix"

publish-marketplace:
@echo "Publishing VS Code extension to VS Marketplace..."
@echo "Verifying PAT..."
npx vsce verify-pat localstack -p $(VSCE_PAT)
npx vsce publish --pre-release $(VERSION) -p $(VSCE_PAT) --no-update-package-json

publish-ovsx:
@echo "Publishing VS Code extension to Open VSX..."
@echo "Verifying PAT..."
npx ovsx verify-pat localstack -p $(OVSX_PAT)
npx ovsx publish localstack-$(VERSION).vsix -p $(OVSX_PAT)
Loading