tauri-plugin-ota-self-update 0.2.1

Self-hosted OTA updates for Tauri v2 web assets.
Documentation
name: Example Build & Validate Action

on:
  push:
    tags:
      - "v*"
  pull_request:

jobs:
  rust:
    runs-on: ubuntu-latest
    env:
      CARGO_TERM_COLOR: always
    steps:
      - uses: actions/checkout@v4
      - name: Install Linux system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y \
            libglib2.0-dev \
            libgobject-2.0-0 \
            libwebkit2gtk-4.1-dev \
            libgtk-3-dev \
            libappindicator3-dev \
            librsvg2-dev \
            patchelf \
            libssl-dev
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Cargo check (desktop)
        run: cargo check
      - name: Cargo check example
        run: cargo check --manifest-path examples/tauri-app/src-tauri/Cargo.toml

  validate-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: pnpm/action-setup@v4
        with:
          version: 9.15.9

      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: "pnpm"

      - name: Install deps
        run: pnpm install --frozen-lockfile=false

      - name: Build JS API
        run: pnpm run build

      - name: Resolve CI defaults
        id: vars
        shell: bash
        run: |
          CHANNEL="stable"
          if [ "${GITHUB_EVENT_NAME}" = "push" ]; then
            VERSION="${GITHUB_REF_NAME#v}"
          else
            VERSION="0.0.0-ci-${GITHUB_RUN_NUMBER}"
          fi
          if [ -z "$CHANNEL" ]; then CHANNEL="stable"; fi
          if [ -z "$VERSION" ]; then VERSION="0.0.0-ci-${GITHUB_RUN_NUMBER}"; fi
          echo "channel=$CHANNEL" >> "$GITHUB_OUTPUT"
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"

      - name: Prepare demo dist
        run: |
          mkdir -p dist
          echo "<html><body>OTA ${{ steps.vars.outputs.version }}</body></html>" > dist/index.html

      - name: Run local publish flow (server mode)
        uses: ./
        with:
          mode: server
          channel: ${{ steps.vars.outputs.channel }}
          version: ${{ steps.vars.outputs.version }}
          dist_dir: dist
          out_dir: .ota-out
          base_url: https://updates.example.com/ota
          server_token: dry-run-token
          dry_run: "true"

  build-example:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
        with:
          version: 9.15.9
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: "pnpm"
      - name: Install root dependencies
        run: pnpm install --frozen-lockfile=false
      - name: Build JS API package
        run: pnpm run build:api
      - name: Install example dependencies
        run: pnpm install --frozen-lockfile=false
        working-directory: examples/tauri-app
      - name: Build example frontend
        run: pnpm run build
        working-directory: examples/tauri-app
      - name: Upload built dist
        uses: actions/upload-artifact@v4
        with:
          name: tauri-app-dist
          path: examples/tauri-app/dist

  verify-marketplace-action:
    runs-on: ubuntu-latest
    needs: [build-example]
    steps:
      - uses: actions/checkout@v4
      - name: Download dist artifact
        uses: actions/download-artifact@v4
        with:
          name: tauri-app-dist
          path: dist
      - name: Resolve verification vars
        id: vars
        shell: bash
        run: |
          CHANNEL="stable"
          if [ "${GITHUB_EVENT_NAME}" = "push" ]; then
            VERSION="${GITHUB_REF_NAME#v}"
          else
            VERSION="0.0.0-ci-${GITHUB_RUN_NUMBER}"
          fi
          if [ -z "$CHANNEL" ]; then CHANNEL="stable"; fi
          if [ -z "$VERSION" ]; then VERSION="0.0.0-ci-${GITHUB_RUN_NUMBER}"; fi
          echo "channel=$CHANNEL" >> "$GITHUB_OUTPUT"
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
      - name: Verify marketplace action wiring (dry-run)
        uses: s00d/tauri-plugin-ota-self-update@v0.2.1
        with:
          mode: github
          channel: ${{ steps.vars.outputs.channel }}
          version: ${{ steps.vars.outputs.version }}
          dist_dir: dist
          out_dir: .ota-out-marketplace
          target_repo: ${{ github.repository }}
          release_tag: ota-${{ steps.vars.outputs.version }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
          base_url: https://updates.example.com/ota
          dry_run: "true"