|
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,181 @@ 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 | + defaults: |
| 84 | + run: |
| 85 | + shell: msys2 {0} |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Checkout repository |
| 89 | + uses: actions/checkout@v6 |
| 90 | + |
| 91 | + - name: Setup MSYS2 |
| 92 | + uses: msys2/setup-msys2@v2 |
| 93 | + with: |
| 94 | + msystem: UCRT64 |
| 95 | + cache: true |
| 96 | + install: >- |
| 97 | + mingw-w64-ucrt-x86_64-gtk4 |
| 98 | + mingw-w64-ucrt-x86_64-libadwaita |
| 99 | + mingw-w64-ucrt-x86_64-python |
| 100 | + mingw-w64-ucrt-x86_64-python-gobject |
| 101 | + mingw-w64-ucrt-x86_64-python-pip |
| 102 | + mingw-w64-ucrt-x86_64-glib2 |
| 103 | + mingw-w64-ucrt-x86_64-pyinstaller |
| 104 | + mingw-w64-ucrt-x86_64-pyinstaller-hooks-contrib |
| 105 | + mingw-w64-ucrt-x86_64-adwaita-icon-theme |
| 106 | + mingw-w64-ucrt-x86_64-gsettings-desktop-schemas |
| 107 | + mingw-w64-ucrt-x86_64-imagemagick |
| 108 | +
|
| 109 | + - name: Convert icon to .ico |
| 110 | + run: | |
| 111 | + magick -background none data/icons/hicolor/scalable/apps/co.logonoff.awakeonlan.svg \ |
| 112 | + -define icon:auto-resize=256,128,64,48,32,16 \ |
| 113 | + awakeonlan.ico |
| 114 | +
|
| 115 | + - name: Prepare entry point |
| 116 | + run: | |
| 117 | + VERSION=${{ needs.release.outputs.version }} |
| 118 | + sed -i "s|@PYTHON@|/usr/bin/python3|" src/awakeonlan.in |
| 119 | + sed -i "s|@VERSION@|$VERSION|" src/awakeonlan.in |
| 120 | + sed -i "s|@pkgdatadir@|.|" src/awakeonlan.in |
| 121 | + sed -i "s|@localedir@|./locale|" src/awakeonlan.in |
| 122 | +
|
| 123 | + - name: Compile GResources |
| 124 | + run: | |
| 125 | + cp data/co.logonoff.awakeonlan.metainfo.xml.in data/co.logonoff.awakeonlan.metainfo.xml |
| 126 | + cd src |
| 127 | + glib-compile-resources --sourcedir=. --sourcedir=.. awakeonlan.gresource.xml --target=awakeonlan.gresource |
| 128 | +
|
| 129 | + - name: Compile GSettings schemas |
| 130 | + run: glib-compile-schemas data/ |
| 131 | + |
| 132 | + - name: Build with PyInstaller |
| 133 | + run: pyinstaller awakeonlan.spec |
| 134 | + |
| 135 | + - name: Bundle additional resources |
| 136 | + run: | |
| 137 | + MSYS_ROOT="/$MSYSTEM" |
| 138 | +
|
| 139 | + # Win32 typelibs into PyInstaller's typelib directory |
| 140 | + cp $MSYS_ROOT/lib/girepository-1.0/GioWin32-*.typelib dist/awakeonlan/_internal/gi_typelibs/ |
| 141 | + cp $MSYS_ROOT/lib/girepository-1.0/GLibWin32-*.typelib dist/awakeonlan/_internal/gi_typelibs/ |
| 142 | + cp $MSYS_ROOT/lib/girepository-1.0/GdkWin32-*.typelib dist/awakeonlan/_internal/gi_typelibs/ |
| 143 | +
|
| 144 | + # GSettings schemas: combine app + MSYS2 schemas and compile together |
| 145 | + mkdir -p dist/awakeonlan/share/glib-2.0/schemas |
| 146 | + cp $MSYS_ROOT/share/glib-2.0/schemas/*.xml dist/awakeonlan/share/glib-2.0/schemas/ || true |
| 147 | + cp data/co.logonoff.awakeonlan.gschema.xml dist/awakeonlan/share/glib-2.0/schemas/ |
| 148 | + glib-compile-schemas dist/awakeonlan/share/glib-2.0/schemas/ |
| 149 | +
|
| 150 | + # Icon themes |
| 151 | + mkdir -p dist/awakeonlan/share/icons |
| 152 | + cp -r $MSYS_ROOT/share/icons/Adwaita dist/awakeonlan/share/icons/ || true |
| 153 | + cp -r $MSYS_ROOT/share/icons/hicolor dist/awakeonlan/share/icons/ || true |
| 154 | +
|
| 155 | + # App icon |
| 156 | + mkdir -p dist/awakeonlan/share/icons/hicolor/scalable/apps |
| 157 | + cp data/icons/hicolor/scalable/apps/co.logonoff.awakeonlan.svg dist/awakeonlan/share/icons/hicolor/scalable/apps/ |
| 158 | + mkdir -p dist/awakeonlan/share/icons/hicolor/symbolic/apps |
| 159 | + cp data/icons/hicolor/symbolic/apps/co.logonoff.awakeonlan-symbolic.svg dist/awakeonlan/share/icons/hicolor/symbolic/apps/ |
| 160 | +
|
| 161 | + - name: Create ZIP archive |
| 162 | + shell: pwsh |
| 163 | + run: Compress-Archive -Path dist/awakeonlan -DestinationPath awakeonlan-${{ needs.release.outputs.version }}-windows-x86_64.zip |
| 164 | + |
| 165 | + - name: Calculate SHA256 |
| 166 | + id: sha256 |
| 167 | + shell: pwsh |
| 168 | + run: | |
| 169 | + $hash = (Get-FileHash awakeonlan-${{ needs.release.outputs.version }}-windows-x86_64.zip -Algorithm SHA256).Hash.ToLower() |
| 170 | + echo "hash=$hash" >> $env:GITHUB_OUTPUT |
| 171 | +
|
| 172 | + - name: Upload to release |
| 173 | + shell: pwsh |
| 174 | + env: |
| 175 | + GH_TOKEN: ${{ github.token }} |
| 176 | + run: gh release upload ${{ needs.release.outputs.version }} awakeonlan-${{ needs.release.outputs.version }}-windows-x86_64.zip |
| 177 | + |
| 178 | + update-manifests: |
| 179 | + runs-on: ubuntu-latest |
| 180 | + needs: [release, windows-build] |
| 181 | + permissions: |
| 182 | + contents: write |
| 183 | + |
| 184 | + steps: |
| 185 | + - name: Checkout repository |
| 186 | + uses: actions/checkout@v6 |
| 187 | + |
| 188 | + - name: Update manifests |
| 189 | + env: |
| 190 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
77 | 191 | 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) |
| 192 | + VERSION=${{ needs.release.outputs.version }} |
| 193 | + TARBALL_HASH=${{ needs.release.outputs.tarball-hash }} |
| 194 | + WINDOWS_HASH=${{ needs.windows-build.outputs.hash }} |
| 195 | +
|
| 196 | + # Update Homebrew formula |
| 197 | + sed -i "s/version \".*\"/version \"$VERSION\"/" Formula/awakeonlan.rb |
| 198 | + sed -i "s/sha256 \".*\"/sha256 \"$TARBALL_HASH\"/" Formula/awakeonlan.rb |
| 199 | +
|
| 200 | + # Update Scoop manifest |
| 201 | + sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" bucket/awakeonlan.json |
| 202 | + sed -i "s|download/.*/awakeonlan-.*-windows-x86_64.zip|download/${VERSION}/awakeonlan-${VERSION}-windows-x86_64.zip|" bucket/awakeonlan.json |
| 203 | + sed -i "s/\"hash\": \".*\"/\"hash\": \"$WINDOWS_HASH\"/" bucket/awakeonlan.json |
| 204 | +
|
| 205 | + FORMULA_CONTENT=$(base64 -w 0 < Formula/awakeonlan.rb) |
| 206 | + SCOOP_CONTENT=$(base64 -w 0 < bucket/awakeonlan.json) |
81 | 207 | 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') |
| 208 | +
|
82 | 209 | jq -n \ |
83 | 210 | --arg oid "$MAIN_OID" \ |
84 | | - --arg content "$CONTENT" \ |
85 | | - --arg version "${{ steps.version.outputs.version }}" \ |
| 211 | + --arg formula "$FORMULA_CONTENT" \ |
| 212 | + --arg scoop "$SCOOP_CONTENT" \ |
| 213 | + --arg version "$VERSION" \ |
86 | 214 | '{ |
87 | 215 | query: "mutation($input: CreateCommitOnBranchInput!) { createCommitOnBranch(input: $input) { commit { oid } } }", |
88 | 216 | variables: { |
89 | 217 | input: { |
90 | 218 | branch: { repositoryNameWithOwner: "logonoff/awake-on-lan", branchName: "main" }, |
91 | 219 | expectedHeadOid: $oid, |
92 | | - message: { headline: ("chore: update formula to " + $version) }, |
93 | | - fileChanges: { additions: [{ path: "Formula/awakeonlan.rb", contents: $content }] } |
| 220 | + message: { headline: ("chore: update manifests to " + $version) }, |
| 221 | + fileChanges: { additions: [ |
| 222 | + { path: "Formula/awakeonlan.rb", contents: $formula }, |
| 223 | + { path: "bucket/awakeonlan.json", contents: $scoop } |
| 224 | + ] } |
94 | 225 | } |
95 | 226 | } |
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 }} |
| 227 | + }' |
| 228 | + # | gh api graphql --input - |
101 | 229 |
|
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 }} |
| 230 | + # - name: Sync homebrew-bucket |
| 231 | + # run: | |
| 232 | + # gh api repos/logonoff/homebrew-bucket/dispatches \ |
| 233 | + # -f event_type=sync |
| 234 | + # env: |
| 235 | + # GH_TOKEN: ${{ secrets.BUCKET_PAT }} |
108 | 236 |
|
109 | 237 | - name: Check if next branch can be fast-forwarded |
110 | 238 | id: check-next |
| 239 | + env: |
| 240 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
111 | 241 | run: | |
112 | 242 | 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 |
| 243 | + git fetch origin next main |
| 244 | + if git merge-base --is-ancestor origin/next origin/main; then |
115 | 245 | echo "can_ff=true" >> "$GITHUB_OUTPUT" |
116 | 246 | fi |
117 | 247 | fi |
118 | 248 |
|
119 | 249 | - name: Fast-forward next branch |
120 | 250 | if: steps.check-next.outputs.can_ff == 'true' |
121 | | - run: git push origin HEAD:next |
| 251 | + run: git push origin origin/main:next |
122 | 252 | env: |
123 | 253 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments