Merge branch 'main' of https://github.com/moohng/unoapi #30
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: 发布 VSCode 扩展 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| name: Release VS Code Extension | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for extension changes | |
| id: filter | |
| uses: dorny/paths-filter@v2 | |
| with: | |
| filters: | | |
| extension: | |
| - 'packages/vscode-extension/package.json' | |
| - name: Setup pnpm | |
| if: steps.filter.outputs.extension == 'true' | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| if: steps.filter.outputs.extension == 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| if: steps.filter.outputs.extension == 'true' | |
| run: pnpm install | |
| - name: Package and Publish | |
| if: steps.filter.outputs.extension == 'true' | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: | | |
| cd packages/vscode-extension | |
| pnpm build | |
| pnpm package | |
| pnpm run publish:marketplace | |
| - name: Get current version | |
| id: get_version | |
| if: steps.filter.outputs.extension == 'true' | |
| run: | | |
| VERSION=$(node -p "require('./packages/vscode-extension/package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Detected release version: $VERSION" | |
| - name: Create GitHub Release | |
| if: steps.filter.outputs.extension == 'true' && steps.get_version.outputs.version != '' | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: vscode-v${{ steps.get_version.outputs.version }} | |
| release_name: VS Code Extension v${{ steps.get_version.outputs.version }} | |
| body: | | |
| ## VS Code Extension Release | |
| Version: ${{ steps.get_version.outputs.version }} | |
| ### Installation | |
| Install from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=qianduanxh.unoapi-vscode-extension) | |
| draft: false | |
| prerelease: false | |
| - name: Upload VSIX to Release | |
| if: steps.filter.outputs.extension == 'true' && steps.get_version.outputs.version != '' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: packages/vscode-extension/*.vsix | |
| asset_name: unoapi-vscode-extension-${{ steps.get_version.outputs.version }}.vsix | |
| asset_content_type: application/zip |