11name : Release VSCode Extension
22on :
3- push :
4- tags :
5- - ' vscode@v*'
3+ workflow_dispatch :
4+ inputs :
5+ version :
6+ description : ' Version to release (e.g., 1.0.0)'
7+ required : true
8+ type : string
69jobs :
710 release :
811 runs-on : ubuntu-latest
912 steps :
1013 - name : Checkout repository
1114 uses : actions/checkout@v4
15+ - name : Check branch is main
16+ run : |
17+ if [[ "${{ github.ref }}" != "refs/heads/main" ]]; then
18+ echo "Error: This workflow can only be run from the main branch"
19+ exit 1
20+ fi
21+ echo "Branch check passed: running from main branch"
22+ - name : Validate version format
23+ run : |
24+ version="${{ github.event.inputs.version }}"
25+ if ! [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
26+ echo "Error: Version must be a valid semantic version (e.g., 1.0.0, 1.0.0-beta.1, 1.0.0+build.1)"
27+ exit 1
28+ fi
29+ echo "Version format is valid: $version"
1230 - name : Setup Node.js
1331 uses : actions/setup-node@v4
1432 with :
@@ -19,25 +37,20 @@ jobs:
1937 version : 10
2038 - name : Install dependencies
2139 run : pnpm install --frozen-lockfile
22- - name : Extract version from tag
23- id : extract_version
24- run : |
25- VERSION=${GITHUB_REF#refs/tags/vscode@v}
26- echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
2740 - name : Update package.json version
2841 working-directory : vscode/extension
2942 run : |
30- npm version ${{ steps.extract_version.outputs.VERSION }} --no-git-tag-version
43+ npm version ${{ github.event.inputs.version }} --no-git-tag-version
3144 - name : Build extension
3245 working-directory : vscode/extension
3346 run : pnpm run vscode:package
3447 - name : Upload extension to Marketplace
3548 working-directory : vscode/extension
3649 run : |
37- pnpx vsce publish --packagePath sqlmesh-${{ steps.extract_version.outputs.VERSION }}.vsix
50+ pnpx vsce publish --packagePath sqlmesh-${{ github.event.inputs.version }}.vsix
3851 env :
3952 VSCE_PAT : ${{ secrets.VSCE_PAT }}
4053 - name : Upload extension to OpenVSX
4154 working-directory : vscode/extension
4255 run : |
43- pnpx ovsx publish -p ${{ secrets.OPEN_VSX_TOKEN }} sqlmesh-${{ steps.extract_version.outputs.VERSION }}.vsix
56+ pnpx ovsx publish -p ${{ secrets.OPEN_VSX_TOKEN }} sqlmesh-${{ github.event.inputs.version }}.vsix
0 commit comments