verifyos-cli 0.13.1

AI agent-friendly Rust CLI for scanning iOS app bundles for App Store rejection risks before submission.
Documentation
name: VS Code Extension

permissions:
  contents: read

on:
  push:
    branches: [ "master", "main" ]
    paths:
      - "editors/vscode/**"
    tags:
      - "v*"
  pull_request:
    branches: [ "master", "main" ]
    paths:
      - "editors/vscode/**"
  workflow_dispatch:
    inputs:
      publish_marketplaces:
        description: "Publish the packaged extension when credentials are available"
        required: false
        default: false
        type: boolean

jobs:
  build-bundled-binaries:
    name: Build bundled binary (${{ matrix.label }})
    runs-on: ${{ matrix.runner }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - runner: ubuntu-latest
            label: linux-x64
            target_dir: linux-x64
            binary_name: voc
          - runner: windows-latest
            label: win32-x64
            target_dir: win32-x64
            binary_name: voc.exe
          - runner: macos-13
            label: darwin-x64
            target_dir: darwin-x64
            binary_name: voc
          - runner: macos-14
            label: darwin-arm64
            target_dir: darwin-arm64
            binary_name: voc
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Build voc release binary
        shell: bash
        run: |
          rustup default stable
          cargo build --release --bin voc

      - name: Stage bundled binary
        shell: bash
        run: |
          mkdir -p "dist/${{ matrix.target_dir }}"
          cp "target/release/${{ matrix.binary_name }}" "dist/${{ matrix.target_dir }}/${{ matrix.binary_name }}"

      - name: Upload bundled binary
        uses: actions/upload-artifact@v4
        with:
          name: vscode-binary-${{ matrix.target_dir }}
          path: dist/${{ matrix.target_dir }}/${{ matrix.binary_name }}

  package:
    name: Package VS Code extension
    needs: build-bundled-binaries
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: editors/vscode
    outputs:
      vsix_name: ${{ steps.package.outputs.vsix_name }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: npm
          cache-dependency-path: editors/vscode/package-lock.json

      - name: Install dependencies
        run: npm ci

      - name: Prepare bundled binary directory
        run: mkdir -p bin/linux-x64 bin/win32-x64 bin/darwin-x64 bin/darwin-arm64

      - name: Download Linux bundled binary
        uses: actions/download-artifact@v4
        with:
          name: vscode-binary-linux-x64
          path: editors/vscode/bin/linux-x64

      - name: Download Windows bundled binary
        uses: actions/download-artifact@v4
        with:
          name: vscode-binary-win32-x64
          path: editors/vscode/bin/win32-x64

      - name: Download macOS x64 bundled binary
        uses: actions/download-artifact@v4
        with:
          name: vscode-binary-darwin-x64
          path: editors/vscode/bin/darwin-x64

      - name: Download macOS arm64 bundled binary
        uses: actions/download-artifact@v4
        with:
          name: vscode-binary-darwin-arm64
          path: editors/vscode/bin/darwin-arm64

      - name: Restore execute permissions for bundled binaries
        shell: bash
        run: |
          chmod +x bin/linux-x64/voc
          chmod +x bin/darwin-x64/voc
          chmod +x bin/darwin-arm64/voc

      - name: Compile extension
        run: npm run compile

      - name: Package .vsix
        id: package
        shell: bash
        run: |
          VERSION="$(node -p "require('./package.json').version")"
          VSIX_NAME="verifyos-vscode-${VERSION}.vsix"
          npm run package -- --out "$VSIX_NAME"
          echo "vsix_name=$VSIX_NAME" >> "$GITHUB_OUTPUT"

      - name: Upload packaged extension
        uses: actions/upload-artifact@v4
        with:
          name: vscode-extension
          path: editors/vscode/${{ steps.package.outputs.vsix_name }}

  publish-vscode-marketplace:
    name: Publish to VS Code Marketplace
    needs: package
    runs-on: ubuntu-latest
    if: >
      (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
      || (github.event_name == 'workflow_dispatch' && inputs.publish_marketplaces == true)
      && secrets.VSCE_PAT != ''
    defaults:
      run:
        working-directory: editors/vscode
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: npm
          cache-dependency-path: editors/vscode/package-lock.json

      - name: Install dependencies
        run: npm ci

      - name: Download packaged extension
        uses: actions/download-artifact@v4
        with:
          name: vscode-extension
          path: editors/vscode/dist-package

      - name: Publish to VS Code Marketplace
        env:
          VSCE_PAT: ${{ secrets.VSCE_PAT }}
        run: npx vsce publish --packagePath "dist-package/${{ needs.package.outputs.vsix_name }}" -p "$VSCE_PAT"

  publish-open-vsx:
    name: Publish to Open VSX
    needs: package
    runs-on: ubuntu-latest
    if: >
      (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
      || (github.event_name == 'workflow_dispatch' && inputs.publish_marketplaces == true)
      && secrets.OVSX_PAT != ''
    defaults:
      run:
        working-directory: editors/vscode
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: npm
          cache-dependency-path: editors/vscode/package-lock.json

      - name: Install dependencies
        run: npm ci

      - name: Download packaged extension
        uses: actions/download-artifact@v4
        with:
          name: vscode-extension
          path: editors/vscode/dist-package

      - name: Publish to Open VSX
        env:
          OVSX_PAT: ${{ secrets.OVSX_PAT }}
        run: npx ovsx publish "dist-package/${{ needs.package.outputs.vsix_name }}" -p "$OVSX_PAT"