From dd8c93b361518d7f99ae175e6b45c66eff7fda15 Mon Sep 17 00:00:00 2001 From: carole-lavillonniere Date: Mon, 3 Nov 2025 13:25:44 +0100 Subject: [PATCH 1/2] CI workflow to publish extensions --- .github/actions/set-version/action.yml | 34 ++++++++++++++++++ .github/workflows/build.yml | 15 ++------ .github/workflows/publish-ovsx.yml | 36 +++++++++++++++++++ .github/workflows/publish-vs-marketplace.yml | 36 +++++++++++++++++++ CHANGELOG.md | 6 +++- Makefile | 38 +++++++++++++++----- package-lock.json | 4 +-- package.json | 2 +- 8 files changed, 146 insertions(+), 25 deletions(-) create mode 100644 .github/actions/set-version/action.yml create mode 100644 .github/workflows/publish-ovsx.yml create mode 100644 .github/workflows/publish-vs-marketplace.yml diff --git a/.github/actions/set-version/action.yml b/.github/actions/set-version/action.yml new file mode 100644 index 0000000..42ee16f --- /dev/null +++ b/.github/actions/set-version/action.yml @@ -0,0 +1,34 @@ +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: | + # GITHUB_HEAD_REF contains the source branch for PRs (e.g., "v1.2.5"), but is empty for pushes + # GITHUB_REF_NAME contains the merge ref for PRs (e.g., "1/merge"), but the branch name for pushes + # Prefer GITHUB_HEAD_REF when available to get the actual branch name + if [ -n "$GITHUB_HEAD_REF" ]; then + BRANCH_NAME="$GITHUB_HEAD_REF" + else + BRANCH_NAME="$GITHUB_REF_NAME" + fi + # Strip leading 'v' if present + VERSION="${BRANCH_NAME#v}" + + # Get version from package.json + PACKAGE_VERSION=$(node -p "require('./package.json').version") + + # Verify versions match + if [ "$VERSION" != "$PACKAGE_VERSION" ]; then + echo "Error: Version mismatch!" + echo " Branch version: $VERSION" + echo " package.json version: $PACKAGE_VERSION" + echo "Please ensure the branch name matches the version in package.json" + exit 1 + fi + + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "Using version: $VERSION (from branch: $BRANCH_NAME)" 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-ovsx.yml b/.github/workflows/publish-ovsx.yml new file mode 100644 index 0000000..9af7043 --- /dev/null +++ b/.github/workflows/publish-ovsx.yml @@ -0,0 +1,36 @@ +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: Publish to Open VSX + run: make publish-ovsx + env: + VERSION: ${{ env.VERSION }} + OVSX_PAT: ${{ secrets.OVSX_PAT }} + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode + NODE_ENV: production + ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events diff --git a/.github/workflows/publish-vs-marketplace.yml b/.github/workflows/publish-vs-marketplace.yml new file mode 100644 index 0000000..b2daeac --- /dev/null +++ b/.github/workflows/publish-vs-marketplace.yml @@ -0,0 +1,36 @@ +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: Publish to VS Marketplace + run: make publish-marketplace + env: + VERSION: ${{ env.VERSION }} + VSCE_PAT: ${{ secrets.VSCE_PAT }} + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode + NODE_ENV: production + ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e6da7c..b1020f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.2.5 (2025-11-05) (pre-release) + +- chore: Testing publishing from Github action + ## 1.2.4 (2025-10-13) - chore: Update dependencies @@ -77,4 +81,4 @@ Initial preview release. - Add feature deploy Lambda to LocalStack - Add feature invoke Lambda in LocalStack -- Add Python CodeLens for triggering deploy and invoke commands \ No newline at end of file +- Add Python CodeLens for triggering deploy and invoke commands diff --git a/Makefile b/Makefile index 9d8e737..ef5114e 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,31 @@ -.PHONY: vsix publish +.PHONY: publish-ovsx publish-marketplace lint 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 +# 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 + +publish-marketplace: + @echo "Publishing VS Code extension to VS Marketplace..." + @echo "Verifying PAT..." + npx vsce verify-pat localstack -p $(VSCE_PAT) + npx vsce publish $(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 --packageVersion $(VERSION) -p $(OVSX_PAT) -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 diff --git a/package-lock.json b/package-lock.json index f0f79e9..1e78ab4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "localstack", - "version": "1.2.4", + "version": "1.2.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "localstack", - "version": "1.2.4", + "version": "1.2.5", "license": "Apache-2.0", "devDependencies": { "@biomejs/biome": "^2.2.3", diff --git a/package.json b/package.json index 3cfa192..dbf0868 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publisher": "LocalStack", "displayName": "LocalStack Toolkit", "description": "LocalStack - Run locally, deploy globally!", - "version": "1.2.4", + "version": "1.2.5", "engines": { "node": ">=20", "vscode": "^1.83.0" From 1d2c4bb0fba99bc654d67a80cfc5c2c869be149a Mon Sep 17 00:00:00 2001 From: carole-lavillonniere Date: Wed, 5 Nov 2025 13:30:10 +0100 Subject: [PATCH 2/2] address comments --- .github/workflows/build.yml | 10 ++- .github/workflows/publish-ovsx.yml | 36 ---------- .github/workflows/publish-vs-marketplace.yml | 36 ---------- .github/workflows/publish.yml | 75 ++++++++++++++++++++ Makefile | 2 +- 5 files changed, 84 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/publish-ovsx.yml delete mode 100644 .github/workflows/publish-vs-marketplace.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dd9795..2b228d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,8 +43,14 @@ jobs: - name: Install dependencies run: npm ci - - name: Test - run: make test + - name: Type check + run: npx tsc + + - name: Compile + run: npx vsce package 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-ovsx.yml b/.github/workflows/publish-ovsx.yml deleted file mode 100644 index 9af7043..0000000 --- a/.github/workflows/publish-ovsx.yml +++ /dev/null @@ -1,36 +0,0 @@ -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: Publish to Open VSX - run: make publish-ovsx - env: - VERSION: ${{ env.VERSION }} - OVSX_PAT: ${{ secrets.OVSX_PAT }} - LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode - NODE_ENV: production - ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events diff --git a/.github/workflows/publish-vs-marketplace.yml b/.github/workflows/publish-vs-marketplace.yml deleted file mode 100644 index b2daeac..0000000 --- a/.github/workflows/publish-vs-marketplace.yml +++ /dev/null @@ -1,36 +0,0 @@ -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: Publish to VS Marketplace - run: make publish-marketplace - env: - VERSION: ${{ env.VERSION }} - VSCE_PAT: ${{ secrets.VSCE_PAT }} - LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode - NODE_ENV: production - ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e3f401b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,75 @@ +name: Publish Extension + +on: + workflow_dispatch: + inputs: + publish_vscode_marketplace: + description: 'Publish to VS Marketplace' + type: boolean + default: true + publish_ovsx: + description: 'Publish to Open VSX' + type: boolean + default: true + +permissions: + contents: read + +jobs: + publish-vscode-marketplace: + name: Publish to VS Marketplace + runs-on: ubuntu-latest + if: ${{ inputs.publish_vscode_marketplace != false }} + + 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: Publish to VS Marketplace + run: make publish-marketplace + env: + VERSION: ${{ env.VERSION }} + VSCE_PAT: ${{ secrets.VSCE_PAT }} + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode + NODE_ENV: production + ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events + + publish-ovsx: + name: Publish to Open VSX + runs-on: ubuntu-latest + if: ${{ inputs.publish_ovsx != false }} + + 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: Publish to Open VSX + run: make publish-ovsx + env: + VERSION: ${{ env.VERSION }} + OVSX_PAT: ${{ secrets.OVSX_PAT }} + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect?name=VSCode + NODE_ENV: production + ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events diff --git a/Makefile b/Makefile index ef5114e..506ed1d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ test: @echo "Compiling extension..." npx vsce package @echo "Running tests..." - xvfb-run -a npx vscode-test + npx vscode-test publish-marketplace: @echo "Publishing VS Code extension to VS Marketplace..."