|
| 1 | +name: Publish VSIX to VSCode & Open VSX (Manual) |
| 2 | + |
| 3 | +# This workflow: |
| 4 | +# - Is manually triggered from GitHub Actions tab |
| 5 | +# - Downloads the .vsix from the specified release tag |
| 6 | +# - Publishes it to: |
| 7 | +# • Visual Studio Marketplace (via vsce) |
| 8 | +# • Open VSX Registry (via ovsx) |
| 9 | +# - Supports dry run mode (no actual publish unless dry_run == false) |
| 10 | + |
| 11 | +on: |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + tag: |
| 15 | + description: 'GitHub release tag to publish (e.g., v1.2.3)' |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + dry_run: |
| 19 | + description: 'Dry run (do not publish)?' |
| 20 | + required: false |
| 21 | + default: 'true' |
| 22 | + type: boolean |
| 23 | + |
| 24 | +jobs: |
| 25 | + publish: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout repo |
| 30 | + uses: actions/checkout@v3 |
| 31 | + |
| 32 | + - name: Set up Node.js |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: 20 |
| 36 | + |
| 37 | + - name: Validate release tag and download .vsix |
| 38 | + run: | |
| 39 | + echo "🔎 Validating release tag '${{ github.event.inputs.tag }}'" |
| 40 | +
|
| 41 | + if ! gh release view ${{ github.event.inputs.tag }} > /dev/null 2>&1; then |
| 42 | + echo "❌ Release tag '${{ github.event.inputs.tag }}' not found." |
| 43 | + exit 1 |
| 44 | + fi |
| 45 | +
|
| 46 | + gh release download ${{ github.event.inputs.tag }} \ |
| 47 | + --pattern "*.vsix" \ |
| 48 | + --dir ./ |
| 49 | +
|
| 50 | + if ! ls ./*.vsix 1> /dev/null 2>&1; then |
| 51 | + echo "❌ No .vsix file found in release '${{ github.event.inputs.tag }}'." |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | +
|
| 55 | + echo "✅ .vsix file downloaded:" |
| 56 | + ls -lh *.vsix |
| 57 | + env: |
| 58 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + |
| 60 | + - name: Install @vscode/vsce and ovsx (latest) |
| 61 | + run: yarn global add @vscode/vsce ovsx |
| 62 | + |
| 63 | + - name: Publish to VSCode Marketplace |
| 64 | + run: | |
| 65 | + echo "▶️ vsce publish --packagePath *.vsix" |
| 66 | + if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then |
| 67 | + vsce publish --packagePath *.vsix |
| 68 | + else |
| 69 | + echo "🟡 dry run enabled: skipping publish to VSCode Marketplace" |
| 70 | + fi |
| 71 | + env: |
| 72 | + VSCE_PAT: ${{ secrets.VSCE_PAT }} |
| 73 | + |
| 74 | + - name: Publish to Open VSX |
| 75 | + run: | |
| 76 | + echo "▶️ ovsx publish *.vsix" |
| 77 | + if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then |
| 78 | + ovsx publish *.vsix |
| 79 | + else |
| 80 | + echo "🟡 dry run enabled: skipping publish to Open VSX" |
| 81 | + fi |
| 82 | + env: |
| 83 | + OVSX_PAT: ${{ secrets.OVSX_PAT }} |
0 commit comments