name: "publish"

on:
  push:
    tags:
      - test-release/*.*.*

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build-binaries:
    strategy:
      fail-fast: false
      matrix:
        platform: [macos-latest, ubuntu-latest, windows-latest]

    runs-on: ${{ matrix.platform }}
    steps:
    - uses: actions/checkout@v3
    
    - name: setup node
      uses: actions/setup-node@v3
      with:
        node-version: 16
    
    - name: install Rust stable
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
    
    - uses: Swatinem/rust-cache@v1

    - name: install dependencies (ubuntu only)
      if: matrix.platform == 'ubuntu-latest'
      run: |
        sudo apt-get update
        sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
    - uses: JonasKruckenberg/tauri-build@v1.1.0
      id: tauri_build
      with:
        projectPath: ./test/fixture
    - run: |
        echo "${{ steps.tauri_build.outputs.artifacts }}"
    # The artifacts output can now be used to upload the artifacts
    - uses: actions/upload-artifact@v3
      with:
        name: artifacts
        path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}"

  # publish:
  #   needs: build-binaries
  #   runs-on: ubuntu-latest
  #   steps:
  #     - uses: actions/checkout@v2
  #     - uses: actions/download-artifact@v3
  #       id: download
  #       with:
  #         name: artifacts
  #         path: artifacts
  #     - name: "create release"
  #       uses: softprops/action-gh-release@master
  #       env:
  #         GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  #       with:
  #         files: ./artifacts/**/*
