fix PPT power limits stuck on dual-backend kernels (asus-nb-wmi + asu… #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Build | |
| on: | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| actions: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Patch version in .csproj | |
| run: | | |
| SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) | |
| VERSION="0.0.0-pr.${{ github.event.pull_request.number }}.${SHORT_SHA}" | |
| sed -i "s|<Version>.*</Version>|<Version>${VERSION}</Version>|" src/GHelper.Linux.csproj | |
| echo "Set version to: ${VERSION}" | |
| - name: Stamp version in udev rules | |
| run: | | |
| SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) | |
| VERSION="0.0.0-pr.${{ github.event.pull_request.number }}.${SHORT_SHA}" | |
| sed -i "s/VERSION_PLACEHOLDER/${VERSION}/" install/90-ghelper.rules | |
| echo "Updated udev rules version to: ${VERSION}" | |
| - name: Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0' | |
| - name: Install Native AOT dependencies | |
| run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev | |
| - name: Restore packages | |
| run: dotnet restore src/ --runtime linux-x64 | |
| - name: Publish Native AOT binary | |
| run: dotnet publish src/ -c Release --no-restore | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ghelper | |
| path: src/bin/Release/net8.0/linux-x64/publish/ghelper | |
| retention-days: 7 | |
| - name: Upload native libs artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-libs | |
| path: | | |
| src/bin/Release/net8.0/linux-x64/publish/libSkiaSharp.so | |
| src/bin/Release/net8.0/linux-x64/publish/libHarfBuzzSharp.so | |
| retention-days: 7 | |
| - name: Upload udev rules artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: udev-rules | |
| path: install/90-ghelper.rules | |
| retention-days: 7 | |
| appimage: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download binary artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ghelper | |
| path: artifacts/ghelper | |
| - name: Download native libs artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-libs | |
| path: artifacts/native-libs | |
| - name: Install libfuse2 | |
| run: sudo apt-get update && sudo apt-get install -y libfuse2 | |
| - name: Download appimagetool | |
| run: | | |
| curl -fsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" \ | |
| -o appimagetool | |
| chmod +x appimagetool | |
| - name: Assemble AppDir | |
| run: | | |
| mkdir -p GHelper.AppDir/usr/bin | |
| cp artifacts/ghelper/ghelper GHelper.AppDir/usr/bin/ | |
| cp artifacts/native-libs/libSkiaSharp.so GHelper.AppDir/usr/bin/ | |
| cp artifacts/native-libs/libHarfBuzzSharp.so GHelper.AppDir/usr/bin/ | |
| chmod +x GHelper.AppDir/usr/bin/ghelper | |
| cp install/ghelper.desktop GHelper.AppDir/ghelper.desktop | |
| cp install/ghelper.png GHelper.AppDir/ghelper.png | |
| printf '#!/bin/bash\nHERE="$(dirname "$(readlink -f "$0")")"\nexec "$HERE/usr/bin/ghelper" "$@"\n' > GHelper.AppDir/AppRun | |
| chmod +x GHelper.AppDir/AppRun | |
| - name: Build AppImage | |
| run: | | |
| export ARCH=x86_64 | |
| ./appimagetool GHelper.AppDir GHelper-x86_64.AppImage | |
| - name: Upload AppImage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appimage | |
| path: GHelper-x86_64.AppImage | |
| retention-days: 7 | |
| comment: | |
| needs: [build, appimage] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Bundle artifacts | |
| run: | | |
| mkdir -p bundle | |
| cp artifacts/ghelper/ghelper bundle/ | |
| cp artifacts/native-libs/libSkiaSharp.so bundle/ | |
| cp artifacts/native-libs/libHarfBuzzSharp.so bundle/ | |
| cp artifacts/udev-rules/90-ghelper.rules bundle/ | |
| cp artifacts/appimage/GHelper-x86_64.AppImage bundle/ | |
| chmod +x bundle/ghelper bundle/GHelper-x86_64.AppImage | |
| - name: Upload combined artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: g-helper-linux-pr-${{ github.event.pull_request.number }} | |
| path: bundle/ | |
| retention-days: 7 | |
| - name: Post or update PR comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const marker = '<!-- pr-build-artifacts -->'; | |
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| const sha = context.payload.pull_request.head.sha.substring(0, 7); | |
| const prNum = context.payload.pull_request.number; | |
| const version = `0.0.0-pr.${prNum}.${sha}`; | |
| const nightlyBase = `https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| const zipName = `g-helper-linux-pr-${prNum}`; | |
| const body = [ | |
| marker, | |
| `### Build Artifacts`, | |
| '', | |
| `Built from commit \`${sha}\` — version \`${version}\``, | |
| '', | |
| `**[Download ${zipName}.zip](${nightlyBase}/${zipName}.zip)**`, | |
| '', | |
| `> [View on GitHub Actions](${runUrl}) (requires login)`, | |
| '', | |
| '---', | |
| '', | |
| '**Contents:**', | |
| '', | |
| '| File | Description |', | |
| '|------|-------------|', | |
| '| `GHelper-x86_64.AppImage` | All-in-one AppImage (easiest to run) |', | |
| '| `ghelper` | Native AOT binary |', | |
| '| `libSkiaSharp.so` | SkiaSharp native library |', | |
| '| `libHarfBuzzSharp.so` | HarfBuzzSharp native library |', | |
| '| `90-ghelper.rules` | Udev rules for hardware access without sudo |', | |
| '', | |
| '---', | |
| '', | |
| '**Quick test:**', | |
| '```bash', | |
| `unzip ${zipName}.zip -d ${zipName}`, | |
| `cd ${zipName}`, | |
| '```', | |
| '', | |
| '**Option A — AppImage (easiest):**', | |
| '```bash', | |
| 'chmod +x GHelper-x86_64.AppImage', | |
| './GHelper-x86_64.AppImage', | |
| '```', | |
| '', | |
| '**Option B — Native binary:**', | |
| '```bash', | |
| 'chmod +x ghelper', | |
| './ghelper', | |
| '```', | |
| '', | |
| '**Install udev rules (required for hardware access):**', | |
| '```bash', | |
| 'sudo cp 90-ghelper.rules /etc/udev/rules.d/', | |
| 'sudo udevadm control --reload-rules && sudo udevadm trigger', | |
| '```', | |
| '', | |
| '> **Note:** Without udev rules, ghelper needs `sudo` to access fan curves, performance modes, keyboard backlight, etc.', | |
| '', | |
| `> Artifacts expire in 7 days.`, | |
| ].join('\n'); | |
| // Find existing comment to update | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| console.log(`Updated comment ${existing.id}`); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| console.log('Created new comment'); | |
| } |