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..2b228d4 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 @@ -54,6 +51,6 @@ jobs: 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..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/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..506ed1d 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..." + 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"