From e7330fa0158cedf662db448565547d26a227c1e3 Mon Sep 17 00:00:00 2001 From: carole-lavillonniere Date: Mon, 3 Nov 2025 13:25:44 +0100 Subject: [PATCH 1/4] CI workflow to publish extension --- .github/workflows/build.yml | 15 ++----- .github/workflows/publish.yml | 82 +++++++++++++++++++++++++++++++++++ Makefile | 42 ++++++++++++++---- 3 files changed, 118 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b5139a..0dd9795 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..86e10e8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,82 @@ +name: Publish Extension + +on: + workflow_dispatch: + inputs: + publish_vs_marketplace: + description: 'Publish to VS Marketplace' + required: true + type: boolean + default: false + publish_open_vsx: + description: 'Publish to Open VSX' + required: true + type: boolean + default: false + +permissions: + contents: read + +jobs: + publish: + name: Build and Publish + 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: Lint + run: make lint + + - name: Test + run: make test + env: + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode + NODE_ENV: ci + + - name: Set version from branch name + run: | + BRANCH_NAME="${GITHUB_REF#refs/heads/}" + # Validate branch name is a valid version (only alphanumeric, dots, and hyphens) + if ! echo "$BRANCH_NAME" | grep -Eq '^[a-zA-Z0-9.-]+$'; then + echo "Error: Branch name '$BRANCH_NAME' is not a valid version format" + echo "Version must contain only letters, numbers, dots, and hyphens" + exit 1 + fi + echo "VERSION=$BRANCH_NAME" >> $GITHUB_ENV + echo "Using version: $BRANCH_NAME" + + - name: Build VSIX package + run: make vsix + env: + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode + NODE_ENV: production + ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events + + - name: Publish to VS Marketplace + if: ${{ inputs.publish_vs_marketplace }} + run: make publish-marketplace + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + + - name: Publish to Open VSX + if: ${{ inputs.publish_open_vsx }} + run: make publish-ovsx + env: + OVSX_PAT: ${{ secrets.OVSX_PAT }} + + - name: Upload VSIX artifact + uses: actions/upload-artifact@v4 + with: + name: localstack-${{ env.VERSION }}.vsix + path: localstack-${{ env.VERSION }}.vsix + retention-days: 7 diff --git a/Makefile b/Makefile index 9d8e737..67ad6a9 100644 --- a/Makefile +++ b/Makefile @@ -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) + @echo "Created: localstack-$(VERSION).vsix" + +publish-marketplace: + @echo "Publishing VS Code extension to VS Marketplace..." + @echo "Verifying PAT..." + npx vsce show localstack -p $(VSCE_PAT) + npx vsce publish localstack-$(VERSION).vsix -p $(VSCE_PAT) + +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) From c61943d06af739db8d111c57fc503b39e54eda50 Mon Sep 17 00:00:00 2001 From: carole-lavillonniere Date: Mon, 3 Nov 2025 16:01:04 +0100 Subject: [PATCH 2/4] comment out publishing for now --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 67ad6a9..1d3fae1 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,10 @@ publish-marketplace: @echo "Publishing VS Code extension to VS Marketplace..." @echo "Verifying PAT..." npx vsce show localstack -p $(VSCE_PAT) - npx vsce publish localstack-$(VERSION).vsix -p $(VSCE_PAT) + # npx vsce publish localstack-$(VERSION).vsix -p $(VSCE_PAT) 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) + # npx ovsx publish localstack-$(VERSION).vsix -p $(OVSX_PAT) From 45c42487a5cd50619ec0de3b7b3ee9d2b622d797 Mon Sep 17 00:00:00 2001 From: carole-lavillonniere Date: Tue, 4 Nov 2025 08:46:54 +0100 Subject: [PATCH 3/4] execute workflow on push --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 86e10e8..6624101 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,7 @@ name: Publish Extension on: + push: workflow_dispatch: inputs: publish_vs_marketplace: From 2e51574f038b13b2d6cc0fb5bbbf419f08eab9d6 Mon Sep 17 00:00:00 2001 From: carole-lavillonniere Date: Tue, 4 Nov 2025 08:50:45 +0100 Subject: [PATCH 4/4] remove branch name check --- .github/workflows/publish.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6624101..acc9c08 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -47,12 +47,6 @@ jobs: - name: Set version from branch name run: | BRANCH_NAME="${GITHUB_REF#refs/heads/}" - # Validate branch name is a valid version (only alphanumeric, dots, and hyphens) - if ! echo "$BRANCH_NAME" | grep -Eq '^[a-zA-Z0-9.-]+$'; then - echo "Error: Branch name '$BRANCH_NAME' is not a valid version format" - echo "Version must contain only letters, numbers, dots, and hyphens" - exit 1 - fi echo "VERSION=$BRANCH_NAME" >> $GITHUB_ENV echo "Using version: $BRANCH_NAME"