diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8c7358..ac656f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,26 @@ on: jobs: release: - runs-on: windows-latest + runs-on: ubuntu-latest + strategy: + matrix: + include: + - goos: windows + goarch: amd64 + extension: .exe + os_name: windows-amd64 + - goos: darwin + goarch: amd64 + extension: "" + os_name: macos-intel + - goos: darwin + goarch: arm64 + extension: "" + os_name: macos-arm64 + - goos: linux + goarch: amd64 + extension: "" + os_name: linux-amd64 steps: - name: Checkout code @@ -25,10 +44,13 @@ jobs: cd cmd/qpn go mod tidy - - name: Build for Windows + - name: Build for ${{ matrix.os_name }} + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} run: | cd cmd/qpn - go build -o qpn.exe + go build -o qpn-${{ matrix.os_name }}${{ matrix.extension }} - name: Get contributors since last release id: contributors @@ -47,16 +69,53 @@ jobs: - name: Create Release Archive run: | - mkdir release - copy cmd\qpn\qpn.exe release\ - copy config.yaml.dist release\ - copy create_autostart_windows_task.bat release\ - copy README.md release\ + mkdir release-${{ matrix.os_name }} + cp cmd/qpn/qpn-${{ matrix.os_name }}${{ matrix.extension }} release-${{ matrix.os_name }}/ + cp cmd/qpn/config.yaml release-${{ matrix.os_name }}/config.yaml.dist + cp cmd/qpn/README.md release-${{ matrix.os_name }}/ - name: Archive Release run: | - Compress-Archive -Path release\* -DestinationPath queue-pop-notification-${{ github.ref_name }}.zip + if [ "${{ matrix.goos }}" = "windows" ]; then + cd release-${{ matrix.os_name }} && zip -r ../queue-pop-notification-${{ matrix.os_name }}-${{ github.ref_name }}.zip . + else + tar -czf queue-pop-notification-${{ matrix.os_name }}-${{ github.ref_name }}.tar.gz -C release-${{ matrix.os_name }} . + fi + - name: Upload Release Assets + uses: actions/upload-artifact@v3 + with: + name: queue-pop-notification-${{ matrix.os_name }}-${{ github.ref_name }} + path: | + queue-pop-notification-${{ matrix.os_name }}-${{ github.ref_name }}.zip + queue-pop-notification-${{ matrix.os_name }}-${{ github.ref_name }}.tar.gz + + create-release: + needs: release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get contributors since last release + id: contributors + run: | + # Get the previous tag + previousTag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + if [ -n "$previousTag" ]; then + contributors=$(git log --pretty=format:"%an" $previousTag..HEAD | sort | uniq) + else + contributors=$(git log --pretty=format:"%an" | sort | uniq) + fi + contributorList=$(echo "$contributors" | sed 's/^/- @/' | tr '\n' '\n') + echo "contributors<> $GITHUB_OUTPUT + echo "$contributorList" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Download all artifacts + uses: actions/download-artifact@v3 + - name: Create Release uses: actions/create-release@v1 id: create_release @@ -68,16 +127,22 @@ jobs: body: | ## Queue Pop Notification ${{ github.ref_name }} + ### Downloads available for: + - **Windows**: `queue-pop-notification-windows-amd64-${{ github.ref_name }}.zip` + - **macOS Intel**: `queue-pop-notification-macos-intel-${{ github.ref_name }}.tar.gz` + - **macOS Apple Silicon**: `queue-pop-notification-macos-arm64-${{ github.ref_name }}.tar.gz` + - **Linux**: `queue-pop-notification-linux-amd64-${{ github.ref_name }}.tar.gz` + ### What's included: - - `qpn.exe` - The main executable + - Main executable (`qpn.exe` for Windows, `qpn-macos-intel`/`qpn-macos-arm64`/`qpn-linux-amd64` for Unix) - `config.yaml.dist` - Configuration file template - - `create_autostart_windows_task.bat` - Script to set up Windows autostart - `README.md` - Documentation ### Installation: - 1. Download and extract the zip file - 2. Rename `config.yaml.dist` to `config.yaml` and edit it with your Discord webhook URL and WoW path - 3. Run `create_autostart_windows_task.bat` as Administrator to set up autostart + 1. Download the appropriate file for your operating system + 2. Extract the archive + 3. Rename `config.yaml.dist` to `config.yaml` and edit it with your Discord webhook URL and WoW path + 4. Start the application by running `qpn.exe` (Windows) or `./qpn-macos-intel`/`./qpn-macos-arm64`/`./qpn-linux-amd64` (Unix) ### Requirements: - World of Warcraft with QueueNotify addon installed @@ -86,17 +151,45 @@ jobs: ${{ steps.contributors.outputs.contributors }} Thank you to all contributors who made this release possible! 🎉 - - draft: false prerelease: false - - name: Upload Release Asset + - name: Upload Windows Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./queue-pop-notification-windows-amd64-${{ github.ref_name }}/queue-pop-notification-windows-amd64-${{ github.ref_name }}.zip + asset_name: queue-pop-notification-windows-amd64-${{ github.ref_name }}.zip + asset_content_type: application/zip + + - name: Upload macOS Intel Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./queue-pop-notification-macos-intel-${{ github.ref_name }}/queue-pop-notification-macos-intel-${{ github.ref_name }}.tar.gz + asset_name: queue-pop-notification-macos-intel-${{ github.ref_name }}.tar.gz + asset_content_type: application/gzip + + - name: Upload macOS ARM64 Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./queue-pop-notification-macos-arm64-${{ github.ref_name }}/queue-pop-notification-macos-arm64-${{ github.ref_name }}.tar.gz + asset_name: queue-pop-notification-macos-arm64-${{ github.ref_name }}.tar.gz + asset_content_type: application/gzip + + - name: Upload Linux Release Asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./queue-pop-notification-${{ github.ref_name }}.zip - asset_name: queue-pop-notification-${{ github.ref_name }}.zip - asset_content_type: application/zip \ No newline at end of file + asset_path: ./queue-pop-notification-linux-amd64-${{ github.ref_name }}/queue-pop-notification-linux-amd64-${{ github.ref_name }}.tar.gz + asset_name: queue-pop-notification-linux-amd64-${{ github.ref_name }}.tar.gz + asset_content_type: application/gzip \ No newline at end of file diff --git a/README.md b/README.md index 67f0c9c..d388cae 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,13 @@ Tired of being tethered to your desk with a wired headset while waiting for a World of Warcraft match? This lightweight application sends a Discord notification the moment your queue pops, so you'll never miss a match again! As of right now due to the restrictions from the QueueNotify addon you only get notifications for Solo-Shuffle and BG Blitz. ---- -I'll probably create a new addon to also receive notifications for 2v2 and 3v3 + some extras like Rating etc. +## Features + +- [x] notifications for Solo-Shuffle and BG Blitz +- [ ] companion addon which provides further ingame information like rating, 2v2 and 3v3 notifications +- [ ] 2v2 and 3v3 notifications +- [ ] rating information ## Prerequisites @@ -49,20 +53,21 @@ go build . ``` This will create the `qpn.exe` executable. -### Run Manually -To run the application directly, execute the compiled file from your terminal: -```sh -./qpn.exe -``` -or just click the executable. +### Start the app +You have two options. Click on the executable which assumes you have a `config.yaml` in the same directory. -### Run Automatically on Startup (Windows) -A batch script is provided to create a Windows Scheduled Task that runs the application automatically when you log in. +Alternatively run start the app manually by executing the compiled file from your terminal: +``` +# windows +qpn.exe -1. Place the `create_autostart_windows_task.bat` script in the same directory as `qpn.exe`. -2. Right-click `create_autostart_windows_task.bat` and select **"Run as administrator"**. +# macos +./qpn-macos-intel +./qpn-macos-arm64 -The script will handle the rest. +# linux +./qpn-linux-amd64 +``` ## Alternatives * [Queue Notify Client](https://github.com/rudikiaz/queue-notify-client) diff --git a/cmd/qpn/main.go b/cmd/qpn/main.go index d21d96d..60e0d06 100644 --- a/cmd/qpn/main.go +++ b/cmd/qpn/main.go @@ -7,9 +7,9 @@ import ( "os" "os/signal" "path/filepath" - "solo-queue-pop/internal/config" - "solo-queue-pop/internal/discord" - "solo-queue-pop/internal/watcher" + "queue-pop-notification/internal/config" + "queue-pop-notification/internal/discord" + "queue-pop-notification/internal/watcher" "syscall" "github.com/spf13/cobra" diff --git a/create_autostart_windows_task.bat b/create_autostart_windows_task.bat deleted file mode 100644 index 1671016..0000000 --- a/create_autostart_windows_task.bat +++ /dev/null @@ -1,46 +0,0 @@ -@echo off - -REM This script creates a scheduled task to run the Solo Queue Pop application when you log in. -REM -REM IMPORTANT: -REM 1. This script assumes your project's executable will be located at 'd:\projects\solo-queue-pop\solo-queue-pop.exe'. -REM You may need to build it first, for example by running 'go build' from the 'd:\projects\solo-queue-pop\solo-queue-pop' directory. -REM 2. Please run this script as an Administrator to ensure it has permission to create scheduled tasks. - -set "EXECUTABLE_PATH=%~dp0qpn.exe" -set "WORKING_DIR=%~dp0" -set "TASK_NAME=WoWQueuePopNotification" - -echo Creating Windows Scheduled Task to run Solo Queue Pop on logon... -echo. -echo Task Name: %TASK_NAME% -echo Executable: %EXECUTABLE_PATH% -echo Working Directory: %WORKING_DIR% -echo. - -REM Check if the executable exists before creating the task -if not exist "%EXECUTABLE_PATH%" ( - echo ERROR: Executable not found at the specified path. - echo Please make sure you have built the project and the path is correct. - pause - exit /b 1 -) - -REM Use schtasks to create the task. -REM /sc ONLOGON - Runs when the user logs in. -REM /tr - Specifies the task to run. We use 'start' to ensure the console window is visible. -REM /f - Overwrites the task if it already exists. -schtasks /create /sc ONLOGON /tn "%TASK_NAME%" /tr "cmd /c start \"%EXECUTABLE_PATH%" /f - -if %errorlevel% equ 0 ( - echo. - echo SUCCESS: Scheduled task '%TASK_NAME%' was created successfully. - echo It will run the next time you log into Windows. -) else ( - echo. - echo ERROR: Failed to create the scheduled task. - echo Please make sure you are running this script as an Administrator. -) - -echo. -pause diff --git a/go.mod b/go.mod index a44f11d..9fa77f3 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module solo-queue-pop +module queue-pop-notification go 1.24.5