tray-wrapper 0.4.1

A simple wrapper library to make it easy to run servers with a GUI tray icon
Documentation
name: Release and Publish
on:
  workflow_dispatch:

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always
  GITHUB_TOKEN: ${{ github.token }}

jobs:
  cargo_version:
    runs-on: "ubuntu-latest"
    outputs:
      needs_release: ${{ steps.check_tag.outputs.needs_release }}
      version: ${{ steps.package_version.outputs.version }}
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - run: rustup update
      - run: cargo install cargo-get

      - id: package_version
        run: echo "version=$(cargo get package.version)" >> $GITHUB_OUTPUT

      - name: Check if tag exists
        id: check_tag
        run: |
          VERSION="${{ steps.package_version.outputs.version }}"
          if git rev-parse "v$VERSION" >/dev/null 2>&1; then
            echo "needs_release=false" >> $GITHUB_OUTPUT
          else
            echo "needs_release=true" >> $GITHUB_OUTPUT
          fi

  crate_publish:
    runs-on: "ubuntu-latest"
    needs: cargo_version
    if: ${{ needs.cargo_version.outputs.needs_release == 'true' }}
    outputs:
      release_built: ${{ steps.set-output.outputs.release_built }}
    steps:
      - name: Install missing linux libs
        run: |
          sudo apt-get update && \
          sudo apt-get install libgtk-3-dev
      - name: Check out code
        uses: actions/checkout@v4
      - name: Cache Dependencies
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - name: Run cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish

  github_draft_release:
    runs-on: "ubuntu-latest"
    needs: [cargo_version, crate_publish]
    if: ${{ needs.cargo_version.outputs.needs_release == 'true' }}
    env:
      VERSION: ${{ needs.cargo_version.outputs.version }}
    steps:
      - name: checkout repository
        uses: actions/checkout@v4
        with:
          submodules: true
      - name: Clean up old drafts
        run: |
          ./build/clean_up_drafts.sh
      - name: create github release (draft)
        run: |
          gh release create v$VERSION \
            -t "Release $VERSION" \
            -n "Release $VERSION" \
            --generate-notes \
            --draft
      - name: tag release
        run: |
          git tag "v$VERSION"
          git push origin "v$VERSION"
        continue-on-error: true