-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub Actions workflow for VSCode extension publishing #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,133 @@ | ||||||||||||||||||||||||||||||||||||
| name: Publish VSCode Extension | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||
| version: | ||||||||||||||||||||||||||||||||||||
| description: 'Version to publish (leave empty to use version from package.json)' | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||
| dry_run: | ||||||||||||||||||||||||||||||||||||
| description: 'Dry run (package only, do not publish)' | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||||||||||||||
| default: false | ||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||
| tags: | ||||||||||||||||||||||||||||||||||||
| - 'vscode-v*.*.*' | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||||||||
| issues: write | ||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||
| publish: | ||||||||||||||||||||||||||||||||||||
| name: Package and Publish VSCode Extension | ||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||
| timeout-minutes: 15 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||
| - name: Checkout Repository | ||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| node-version: 20 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Install pnpm | ||||||||||||||||||||||||||||||||||||
| uses: pnpm/action-setup@v3 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| version: 10 | ||||||||||||||||||||||||||||||||||||
| run_install: false | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Get pnpm store directory | ||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Setup pnpm cache | ||||||||||||||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| path: ${{ env.STORE_PATH }} | ||||||||||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||||||||||||||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||||||||||||||
| ${{ runner.os }}-pnpm-store- | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Install Dependencies | ||||||||||||||||||||||||||||||||||||
| run: pnpm install | ||||||||||||||||||||||||||||||||||||
| timeout-minutes: 3 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Build Monorepo | ||||||||||||||||||||||||||||||||||||
| run: pnpm run build | ||||||||||||||||||||||||||||||||||||
| timeout-minutes: 5 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Build VSCode Extension | ||||||||||||||||||||||||||||||||||||
| working-directory: packages/tools/vscode-objectql | ||||||||||||||||||||||||||||||||||||
| run: pnpm run compile | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Update Version (if specified) | ||||||||||||||||||||||||||||||||||||
| if: inputs.version != '' | ||||||||||||||||||||||||||||||||||||
| working-directory: packages/tools/vscode-objectql | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| echo "Updating version to ${{ inputs.version }}" | ||||||||||||||||||||||||||||||||||||
| npm version ${{ inputs.version }} --no-git-tag-version | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
Comment on lines
+74
to
+76
|
||||||||||||||||||||||||||||||||||||
| echo "Updating version to ${{ inputs.version }}" | |
| npm version ${{ inputs.version }} --no-git-tag-version | |
| VERSION="${{ inputs.version }}" | |
| # Allow npm version keywords and semantic version strings (X.Y.Z with optional pre-release/build) | |
| if [[ "$VERSION" == "patch" || "$VERSION" == "minor" || "$VERSION" == "major" || \ | |
| "$VERSION" == "prepatch" || "$VERSION" == "preminor" || "$VERSION" == "premajor" || \ | |
| "$VERSION" == "prerelease" ]]; then | |
| echo "Updating version using npm keyword: $VERSION" | |
| elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then | |
| echo "Updating version to semantic version: $VERSION" | |
| else | |
| echo "::error::Invalid version input '$VERSION'. Expected a semantic version (e.g., 1.2.3) or one of: patch, minor, major, prepatch, preminor, premajor, prerelease." | |
| exit 1 | |
| fi | |
| npm version "$VERSION" --no-git-tag-version |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'ls *.vsix' to capture the filename can fail if multiple .vsix files exist in the directory. Consider using a more robust approach such as specifying the exact filename based on the package.json name and version, or using 'ls -1 *.vsix | head -n 1' to ensure only one file is captured.
| echo "VSIX_FILE=$(ls *.vsix)" >> $GITHUB_ENV | |
| echo "VSIX_FILE=$(ls -1 *.vsix | head -n 1)" >> $GITHUB_ENV |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VSCE_PAT secret is properly quoted when passed to the vsce command, which is good for security. However, consider using the environment variable approach instead of passing it via command line argument. The vsce tool automatically reads from the VSCE_PAT environment variable, so you could simplify line 100 to just 'npx @vscode/vsce publish --no-yarn' and rely on the env block on line 94.
| npx @vscode/vsce publish --no-yarn --pat "$VSCE_PAT" | |
| npx @vscode/vsce publish --no-yarn |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql) | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow permissions include 'issues: write' and 'pull-requests: write', but the workflow does not interact with issues or pull requests. These permissions should be removed to follow the principle of least privilege. Only 'contents: write' is needed for creating releases.