untauri 0.5.1

Extract, inspect and patch the web frontend inside compiled Tauri apps.
# Builds untauri for every platform. On a pull request it only builds and tests,
# so a broken target shows up before release. On a `v*` tag it also attaches the
# archives and their checksums to a GitHub release.
name: release

on:
  pull_request:
  push:
    branches: [main]
    tags: ["v*"]

permissions:
  contents: write

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        include:
          - { target: x86_64-unknown-linux-musl, os: ubuntu-latest, test: true }
          - { target: aarch64-unknown-linux-musl, os: ubuntu-24.04-arm, test: true }
          - { target: aarch64-apple-darwin, os: macos-latest, test: true }
          - { target: x86_64-apple-darwin, os: macos-latest, test: false }
          - { target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
          - { target: aarch64-pc-windows-msvc, os: windows-latest, test: false }
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - run: rustup target add ${{ matrix.target }}
      - if: contains(matrix.target, 'musl')
        run: sudo apt-get update && sudo apt-get install -y musl-tools
      - if: matrix.test
        run: cargo test --target ${{ matrix.target }}
      - run: cargo build --release --locked --target ${{ matrix.target }}

      - name: Package (unix)
        if: runner.os != 'Windows'
        shell: bash
        run: |
          name=untauri-${{ matrix.target }}
          mkdir "$name"
          cp target/${{ matrix.target }}/release/untauri README.md LICENSE "$name"/
          tar czf "$name.tar.gz" "$name"
          echo "ASSET=$name.tar.gz" >> "$GITHUB_ENV"
      - name: Package (windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          $name = "untauri-${{ matrix.target }}"
          New-Item -ItemType Directory $name | Out-Null
          Copy-Item target/${{ matrix.target }}/release/untauri.exe, README.md, LICENSE $name
          Compress-Archive $name "$name.zip"
          "ASSET=$name.zip" >> $env:GITHUB_ENV

      - uses: actions/upload-artifact@v4
        with:
          name: ${{ env.ASSET }}
          path: ${{ env.ASSET }}

  release:
    if: startsWith(github.ref, 'refs/tags/v')
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          path: dist
          merge-multiple: true
      - name: Checksums
        run: cd dist && sha256sum * > SHA256SUMS
      - name: Publish release
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh release create "${GITHUB_REF_NAME}" dist/* --repo "${{ github.repository }}" --title "${GITHUB_REF_NAME}" --generate-notes