bulid vscode #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build VSIX and Upload Artifact | |
| on: | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| build-and-upload: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install global dependencies | |
| run: | | |
| npm install -g typescript prettier eslint vsce | |
| - name: Install project dependencies | |
| run: npm install | |
| - name: Build .vsix package | |
| run: npm run build | |
| - name: Set .vsix file path | |
| id: get_vsix | |
| run: | | |
| VERSION=$(jq -r '.version' package.json) | |
| VSIX_PATH="./testdriver-${VERSION}.vsix" | |
| if [ ! -f "$VSIX_PATH" ]; then | |
| echo "VSIX file not found at $VSIX_PATH" | |
| exit 1 | |
| fi | |
| echo "vsix_path=$VSIX_PATH" >> $GITHUB_OUTPUT | |
| - name: Extract version from package.json | |
| id: get_version | |
| run: | | |
| VERSION=$(jq -r '.version' package.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Upload .vsix as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vscode-extension | |
| path: ${{ steps.get_vsix.outputs.vsix_path }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| release_name: Release v${{ steps.get_version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload .vsix to GitHub Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ steps.get_vsix.outputs.vsix_path }} | |
| asset_name: testdriver.vsix | |
| asset_content_type: application/octet-stream | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |