hyprswitch 3.3.2

A CLI/GUI that allows switching between windows in Hyprland
name: Publish

on:
  push:
    tags:
      - v*

env:
  CARGO_TERM_COLOR: always
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
  publish:
    permissions:
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: install Rust stable
        uses: dtolnay/rust-toolchain@stable
      - name: Install gtk4-layer-shell
        working-directory: /tmp
        run: |
          sudo apt-get update
          sudo apt -y install git libglib2.0-dev libgraphene-1.0-dev meson ninja-build libwayland-dev libgtk-4-dev gobject-introspection libadwaita-1-dev libgirepository1.0-dev python3 valac
          git clone https://github.com/wmww/gtk4-layer-shell
          cd gtk4-layer-shell
          meson setup build
          ninja -C build
          sudo ninja -C build install
          sudo ldconfig
      - name: Publish to crates.io
        run: cargo publish --all-features --allow-dirty --token ${{ secrets.CRATES_TOKEN }}
      - name: Check if tag is -rc or -alpha and exit if it is
        run: |
          if [[ ${{ github.ref }} == *"-rc"* ]] || [[ ${{ github.ref }} == *"-alpha"* ]]; then
            echo "Skipping publish for ${{ github.ref }}"
            exit 1
          fi
      - name: Publish AUR package
        uses: KSXGitHub/github-actions-deploy-aur@v3.0.1
        with:
          pkgname: hyprswitch
          pkgbuild: ./PKGBUILD
          commit_username: ${{ secrets.AUR_USERNAME }}
          commit_email: ${{ secrets.AUR_EMAIL }}
          ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
          commit_message: Update AUR package
          updpkgsums: true
          ssh_keyscan_types: rsa,ecdsa,ed25519
      - name: Push commits from tag to release
        run: |
          TAG_NAME=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///')
          PR_URL=$(gh pr create --title "Release $TAG_NAME" --fill --base release --head main)
          echo "Pull Request URL: $PR_URL"
          gh pr merge --squash --auto $PR_URL
        env:
          GH_TOKEN: ${{ github.token }}