|
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | permissions: |
12 | 12 | contents: write |
| 13 | + outputs: |
| 14 | + version: ${{ steps.version.outputs.version }} |
| 15 | + tarball-hash: ${{ steps.sha256.outputs.hash }} |
13 | 16 |
|
14 | 17 | steps: |
15 | 18 | - name: Checkout repository |
|
32 | 35 | meson setup build |
33 | 36 | meson dist -C build --no-tests --include-subprojects |
34 | 37 |
|
35 | | - # Find the generated tarball |
36 | 38 | TARBALL=$(ls build/meson-dist/*.tar.xz) |
37 | | -
|
38 | | - # Rename to standard format |
39 | 39 | mv "$TARBALL" "awakeonlan-${{ steps.version.outputs.version }}.tar.xz" |
40 | 40 |
|
41 | 41 | - name: Calculate SHA256 |
@@ -73,51 +73,191 @@ jobs: |
73 | 73 | --title "Awake on LAN ${{ steps.version.outputs.version }}" \ |
74 | 74 | --notes "${{ steps.release_notes.outputs.notes }}" |
75 | 75 |
|
76 | | - - name: Update Homebrew formula |
| 76 | + windows-build: |
| 77 | + runs-on: windows-latest |
| 78 | + needs: release |
| 79 | + permissions: |
| 80 | + contents: write |
| 81 | + outputs: |
| 82 | + hash: ${{ steps.sha256.outputs.hash }} |
| 83 | + env: |
| 84 | + gvsbuild_version: 2026.4.1 |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Checkout repository |
| 88 | + uses: actions/checkout@v6 |
| 89 | + |
| 90 | + - name: GTK binaries get from cache |
| 91 | + uses: actions/cache@v4 |
| 92 | + id: cache |
| 93 | + with: |
| 94 | + path: C:\gtk\** |
| 95 | + key: ${{ runner.os }}-gvsbuild-${{ env.gvsbuild_version }} |
| 96 | + |
| 97 | + - name: Download Gvsbuild |
| 98 | + if: steps.cache.outputs.cache-hit != 'true' |
| 99 | + env: |
| 100 | + GH_TOKEN: ${{ github.token }} |
77 | 101 | run: | |
78 | | - sed -i "s/version \".*\"/version \"${{ steps.version.outputs.version }}\"/" Formula/awakeonlan.rb |
79 | | - sed -i "s/sha256 \".*\"/sha256 \"${{ steps.sha256.outputs.hash }}\"/" Formula/awakeonlan.rb |
80 | | - CONTENT=$(base64 -w 0 < Formula/awakeonlan.rb) |
| 102 | + $version = $env:gvsbuild_version |
| 103 | + gh release download --repo wingtk/gvsbuild "$version" -p "GTK4_Gvsbuild_$($version)_x64.zip" |
| 104 | + 7z x "GTK4_Gvsbuild_$($version)_x64.zip" -oC:\gtk -y |
| 105 | +
|
| 106 | + - name: Set up GTK environment |
| 107 | + run: | |
| 108 | + Write-Output "C:\gtk\bin" >> $env:GITHUB_PATH |
| 109 | + Write-Output "PKG_CONFIG=C:\gtk\bin\pkgconf.exe" >> $env:GITHUB_ENV |
| 110 | + Write-Output "XDG_DATA_HOME=$HOME\.local\share" >> $env:GITHUB_ENV |
| 111 | +
|
| 112 | + - name: Set up Python |
| 113 | + uses: actions/setup-python@v5 |
| 114 | + with: |
| 115 | + python-version: '3.14' |
| 116 | + |
| 117 | + - name: Install Python dependencies |
| 118 | + run: | |
| 119 | + pip install --force-reinstall (Resolve-Path C:\gtk\wheels\PyGObject*.whl) |
| 120 | + pip install --force-reinstall (Resolve-Path C:\gtk\wheels\pycairo*.whl) |
| 121 | + pip install pyinstaller pyinstaller-hooks-contrib |
| 122 | +
|
| 123 | + - name: Verify gi module |
| 124 | + run: | |
| 125 | + python -c "import sys; print('Python:', sys.executable)" |
| 126 | + pip show PyGObject |
| 127 | + python -c "import os; os.add_dll_directory(r'C:\gtk\bin'); os.environ['GI_TYPELIB_PATH']=r'C:\gtk\lib\girepository-1.0'; import gi; gi.require_version('Gtk', '4.0'); gi.require_version('Adw', '1'); from gi.repository import Gtk, Adw; print('GTK', Gtk.get_major_version(), Gtk.get_minor_version()); print('Adw', Adw.MAJOR_VERSION, Adw.MINOR_VERSION); print('AboutWindow.new_from_appdata:', hasattr(Adw.AboutWindow, 'new_from_appdata'))" |
| 128 | +
|
| 129 | + - name: Convert icon to .ico |
| 130 | + run: magick -background none data/icons/hicolor/scalable/apps/co.logonoff.awakeonlan.svg -define icon:auto-resize=256,128,64,48,32,16 awakeonlan.ico |
| 131 | + |
| 132 | + - name: Prepare entry point |
| 133 | + run: | |
| 134 | + $version = "${{ needs.release.outputs.version }}" |
| 135 | + (Get-Content src/awakeonlan.in) ` |
| 136 | + -replace '@PYTHON@','/usr/bin/python3' ` |
| 137 | + -replace '@VERSION@',$version ` |
| 138 | + -replace '@pkgdatadir@','.' ` |
| 139 | + -replace '@localedir@','./locale' | |
| 140 | + Set-Content src/awakeonlan.in |
| 141 | +
|
| 142 | + - name: Compile GResources |
| 143 | + run: | |
| 144 | + Copy-Item data/co.logonoff.awakeonlan.metainfo.xml.in data/co.logonoff.awakeonlan.metainfo.xml |
| 145 | + Push-Location src |
| 146 | + glib-compile-resources --sourcedir=. --sourcedir=.. awakeonlan.gresource.xml --target=awakeonlan.gresource |
| 147 | + Pop-Location |
| 148 | +
|
| 149 | + - name: Compile GSettings schemas |
| 150 | + run: glib-compile-schemas data/ |
| 151 | + |
| 152 | + - name: Build with PyInstaller |
| 153 | + run: pyinstaller awakeonlan.spec |
| 154 | + |
| 155 | + - name: Bundle additional resources |
| 156 | + run: | |
| 157 | + # GSettings schemas: combine app + gvsbuild schemas |
| 158 | + New-Item -ItemType Directory -Force dist/awakeonlan/share/glib-2.0/schemas |
| 159 | + Copy-Item C:\gtk\share\glib-2.0\schemas\*.xml dist/awakeonlan/share/glib-2.0/schemas/ |
| 160 | + Copy-Item data/co.logonoff.awakeonlan.gschema.xml dist/awakeonlan/share/glib-2.0/schemas/ |
| 161 | + glib-compile-schemas dist/awakeonlan/share/glib-2.0/schemas/ |
| 162 | +
|
| 163 | + # Icon themes |
| 164 | + New-Item -ItemType Directory -Force dist/awakeonlan/share/icons |
| 165 | + Copy-Item -Recurse C:\gtk\share\icons\Adwaita dist/awakeonlan/share/icons/ |
| 166 | + Copy-Item -Recurse C:\gtk\share\icons\hicolor dist/awakeonlan/share/icons/ |
| 167 | +
|
| 168 | + # App icon |
| 169 | + New-Item -ItemType Directory -Force dist/awakeonlan/share/icons/hicolor/scalable/apps |
| 170 | + Copy-Item data/icons/hicolor/scalable/apps/co.logonoff.awakeonlan.svg dist/awakeonlan/share/icons/hicolor/scalable/apps/ |
| 171 | + New-Item -ItemType Directory -Force dist/awakeonlan/share/icons/hicolor/symbolic/apps |
| 172 | + Copy-Item data/icons/hicolor/symbolic/apps/co.logonoff.awakeonlan-symbolic.svg dist/awakeonlan/share/icons/hicolor/symbolic/apps/ |
| 173 | +
|
| 174 | + - name: Create ZIP archive |
| 175 | + run: Compress-Archive -Path dist/awakeonlan -DestinationPath awakeonlan-${{ needs.release.outputs.version }}-windows-x86_64.zip |
| 176 | + |
| 177 | + - name: Calculate SHA256 |
| 178 | + id: sha256 |
| 179 | + run: | |
| 180 | + $hash = (Get-FileHash awakeonlan-${{ needs.release.outputs.version }}-windows-x86_64.zip -Algorithm SHA256).Hash.ToLower() |
| 181 | + echo "hash=$hash" >> $env:GITHUB_OUTPUT |
| 182 | +
|
| 183 | + - name: Upload to release |
| 184 | + env: |
| 185 | + GH_TOKEN: ${{ github.token }} |
| 186 | + run: gh release upload ${{ needs.release.outputs.version }} awakeonlan-${{ needs.release.outputs.version }}-windows-x86_64.zip |
| 187 | + |
| 188 | + update-manifests: |
| 189 | + runs-on: ubuntu-latest |
| 190 | + needs: [release, windows-build] |
| 191 | + permissions: |
| 192 | + contents: write |
| 193 | + |
| 194 | + steps: |
| 195 | + - name: Checkout repository |
| 196 | + uses: actions/checkout@v6 |
| 197 | + |
| 198 | + - name: Update manifests |
| 199 | + env: |
| 200 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 201 | + run: | |
| 202 | + VERSION=${{ needs.release.outputs.version }} |
| 203 | + TARBALL_HASH=${{ needs.release.outputs.tarball-hash }} |
| 204 | + WINDOWS_HASH=${{ needs.windows-build.outputs.hash }} |
| 205 | +
|
| 206 | + # Update Homebrew formula |
| 207 | + sed -i "s/version \".*\"/version \"$VERSION\"/" Formula/awakeonlan.rb |
| 208 | + sed -i "s/sha256 \".*\"/sha256 \"$TARBALL_HASH\"/" Formula/awakeonlan.rb |
| 209 | +
|
| 210 | + # Update Scoop manifest |
| 211 | + sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" bucket/awakeonlan.json |
| 212 | + sed -i "s|download/.*/awakeonlan-.*-windows-x86_64.zip|download/${VERSION}/awakeonlan-${VERSION}-windows-x86_64.zip|" bucket/awakeonlan.json |
| 213 | + sed -i "s/\"hash\": \".*\"/\"hash\": \"$WINDOWS_HASH\"/" bucket/awakeonlan.json |
| 214 | +
|
| 215 | + FORMULA_CONTENT=$(base64 -w 0 < Formula/awakeonlan.rb) |
| 216 | + SCOOP_CONTENT=$(base64 -w 0 < bucket/awakeonlan.json) |
81 | 217 | MAIN_OID=$(gh api graphql -f query='{ repository(owner:"logonoff", name:"awake-on-lan") { ref(qualifiedName:"refs/heads/main") { target { oid } } } }' --jq '.data.repository.ref.target.oid') |
| 218 | +
|
82 | 219 | jq -n \ |
83 | 220 | --arg oid "$MAIN_OID" \ |
84 | | - --arg content "$CONTENT" \ |
85 | | - --arg version "${{ steps.version.outputs.version }}" \ |
| 221 | + --arg formula "$FORMULA_CONTENT" \ |
| 222 | + --arg scoop "$SCOOP_CONTENT" \ |
| 223 | + --arg version "$VERSION" \ |
86 | 224 | '{ |
87 | 225 | query: "mutation($input: CreateCommitOnBranchInput!) { createCommitOnBranch(input: $input) { commit { oid } } }", |
88 | 226 | variables: { |
89 | 227 | input: { |
90 | 228 | branch: { repositoryNameWithOwner: "logonoff/awake-on-lan", branchName: "main" }, |
91 | 229 | expectedHeadOid: $oid, |
92 | | - message: { headline: ("chore: update formula to " + $version) }, |
93 | | - fileChanges: { additions: [{ path: "Formula/awakeonlan.rb", contents: $content }] } |
| 230 | + message: { headline: ("chore: update manifests to " + $version) }, |
| 231 | + fileChanges: { additions: [ |
| 232 | + { path: "Formula/awakeonlan.rb", contents: $formula }, |
| 233 | + { path: "bucket/awakeonlan.json", contents: $scoop } |
| 234 | + ] } |
94 | 235 | } |
95 | 236 | } |
96 | | - }' | gh api graphql --input - |
97 | | - git checkout -- Formula/awakeonlan.rb |
98 | | - git pull --ff-only origin main |
99 | | - env: |
100 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 237 | + }' |
| 238 | + # | gh api graphql --input - |
101 | 239 |
|
102 | | - - name: Sync homebrew-bucket |
103 | | - run: | |
104 | | - gh api repos/logonoff/homebrew-bucket/dispatches \ |
105 | | - -f event_type=sync |
106 | | - env: |
107 | | - GH_TOKEN: ${{ secrets.BUCKET_PAT }} |
| 240 | + # - name: Sync homebrew-bucket |
| 241 | + # run: | |
| 242 | + # gh api repos/logonoff/homebrew-bucket/dispatches \ |
| 243 | + # -f event_type=sync |
| 244 | + # env: |
| 245 | + # GH_TOKEN: ${{ secrets.BUCKET_PAT }} |
108 | 246 |
|
109 | 247 | - name: Check if next branch can be fast-forwarded |
110 | 248 | id: check-next |
| 249 | + env: |
| 250 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
111 | 251 | run: | |
112 | 252 | if git ls-remote --exit-code origin next &>/dev/null; then |
113 | | - git fetch origin next |
114 | | - if git merge-base --is-ancestor origin/next HEAD; then |
| 253 | + git fetch origin next main |
| 254 | + if git merge-base --is-ancestor origin/next origin/main; then |
115 | 255 | echo "can_ff=true" >> "$GITHUB_OUTPUT" |
116 | 256 | fi |
117 | 257 | fi |
118 | 258 |
|
119 | 259 | - name: Fast-forward next branch |
120 | 260 | if: steps.check-next.outputs.can_ff == 'true' |
121 | | - run: git push origin HEAD:next |
| 261 | + run: git push origin origin/main:next |
122 | 262 | env: |
123 | 263 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments