| 1 | # Windows Release for WinGet |
| 2 | |
| 3 | This repository now includes a Windows release path intended for WinGet distribution. |
| 4 | |
| 5 | ## Output |
| 6 | |
| 7 | Running `scripts/release-windows-winget.ps1` produces: |
| 8 | |
| 9 | - `OpenCC-<version>-windows-x64-portable.zip` |
| 10 | - `OpenCC-<version>-windows-x64-portable.zip.sha256` |
| 11 | - `winget-manifests/b/BYVoid/OpenCC/<version>/` |
| 12 | |
| 13 | By default the WinGet identity remains `BYVoid.OpenCC`, and the generated `InstallerUrl` points at `https://opencc.byvoid.com/opencc-winget-release`. |
| 14 | |
| 15 | The zip is structured as a portable package: |
| 16 | |
| 17 | - `bin/*.exe` |
| 18 | - `share/opencc/*.json` |
| 19 | - `share/opencc/*.ocd2` |
| 20 | |
| 21 | OpenCC now also searches `../share/opencc` relative to the running executable or library on Windows, so the portable package works after WinGet extracts it. |
| 22 | |
| 23 | The WinGet manifest continues to use `InstallerType: zip` with `NestedInstallerType: portable`. This is intentional: OpenCC still needs `share/opencc/*` alongside the command binaries, even though the executables are now built as static binaries for WinGet release packaging. |
| 24 | |
| 25 | ## Directory layout |
| 26 | |
| 27 | With the default arguments: |
| 28 | |
| 29 | - `BuildDir = build\winget-x64` |
| 30 | - `OutputDir = dist\winget-x64` |
| 31 | |
| 32 | the Windows release flow writes files into these locations: |
| 33 | |
| 34 | ```text |
| 35 | build/ |
| 36 | winget-x64/ |
| 37 | src/ |
| 38 | data/ |
| 39 | test/ |
| 40 | Release/ |
| 41 | Testing/ |
| 42 | |
| 43 | dist/ |
| 44 | winget-x64/ |
| 45 | OpenCC-<version>-windows-x64-portable.zip |
| 46 | OpenCC-<version>-windows-x64-portable.zip.sha256 |
| 47 | install/ |
| 48 | bin/ |
| 49 | include/ |
| 50 | lib/ |
| 51 | share/ |
| 52 | staging/ |
| 53 | bin/ |
| 54 | opencc.exe |
| 55 | opencc_dict.exe |
| 56 | opencc_phrase_extract.exe |
| 57 | share/ |
| 58 | opencc/ |
| 59 | *.json |
| 60 | *.ocd2 |
| 61 | LICENSE.txt |
| 62 | README.md |
| 63 | winget-manifests/ |
| 64 | b/ |
| 65 | BYVoid/ |
| 66 | OpenCC/ |
| 67 | <version>/ |
| 68 | BYVoid.OpenCC.yaml |
| 69 | BYVoid.OpenCC.installer.yaml |
| 70 | BYVoid.OpenCC.locale.en-US.yaml |
| 71 | ``` |
| 72 | |
| 73 | The important distinction is: |
| 74 | |
| 75 | - `build\winget-x64` is the CMake and test working directory |
| 76 | - `dist\winget-x64\install\...` is the full CMake install tree |
| 77 | - `dist\winget-x64\staging\...` is the runtime-only portable tree before zipping |
| 78 | - `dist\winget-x64\OpenCC-<version>-windows-x64-portable.zip` is the final release asset |
| 79 | - `dist\winget-x64\winget-manifests\...` is the manifest payload to copy into `winget-pkgs` |
| 80 | |
| 81 | The final zip intentionally excludes development and test files such as: |
| 82 | |
| 83 | - `include/**` |
| 84 | - `lib/**` |
| 85 | - `gtest*` |
| 86 | - `gmock*` |
| 87 | |
| 88 | ## Local build |
| 89 | |
| 90 | Run this from a Visual Studio developer shell or an environment where MSVC is configured: |
| 91 | |
| 92 | ```powershell |
| 93 | ./scripts/release-windows-winget.ps1 |
| 94 | ``` |
| 95 | |
| 96 | To build a specific tag or skip tests: |
| 97 | |
| 98 | ```powershell |
| 99 | ./scripts/release-windows-winget.ps1 -Version 1.2.0 |
| 100 | ./scripts/release-windows-winget.ps1 -Version 1.2.1-rc1 |
| 101 | ./scripts/release-windows-winget.ps1 -Version 1.2.1-alpha1 |
| 102 | ./scripts/release-windows-winget.ps1 -Version ver.1.2.0 -SkipTests |
| 103 | ``` |
| 104 | |
| 105 | To test from a fork while keeping the upstream WinGet package identity: |
| 106 | |
| 107 | ```powershell |
| 108 | ./scripts/release-windows-winget.ps1 -Version 1.2.1-rc1 -GitHubRepository frankslin/OpenCC |
| 109 | ``` |
| 110 | |
| 111 | This keeps: |
| 112 | |
| 113 | - `PackageIdentifier: BYVoid.OpenCC` |
| 114 | - `manifests/b/BYVoid/OpenCC/<version>/` |
| 115 | |
| 116 | but points release URLs at: |
| 117 | |
| 118 | - `https://github.com/frankslin/OpenCC` |
| 119 | |
| 120 | The public download base URL is fixed to: |
| 121 | |
| 122 | ```text |
| 123 | https://opencc.byvoid.com/opencc-winget-release |
| 124 | ``` |
| 125 | |
| 126 | Accepted version formats are: |
| 127 | |
| 128 | - `x.y.z` |
| 129 | - `x.y.z-rcN` |
| 130 | - `x.y.z-alphaN` |
| 131 | |
| 132 | Values such as `1.2.0.exp` are rejected. |
| 133 | |
| 134 | ## GitHub Actions |
| 135 | |
| 136 | The workflow `.github/workflows/release-winget.yml` runs on: |
| 137 | |
| 138 | - pushed tags matching `ver.*` |
| 139 | - manual `workflow_dispatch` |
| 140 | |
| 141 | On a tag build it will: |
| 142 | |
| 143 | 1. build the x64 portable Windows release |
| 144 | 2. upload the zip and checksum to the GitHub release |
| 145 | 3. upload the generated WinGet manifests as a workflow artifact |
| 146 | |
| 147 | The workflow passes `${{ github.repository }}` into the release script, so fork builds point to the fork's GitHub release URLs automatically while still using the upstream WinGet package identifier by default. |
| 148 | |
| 149 | ## WinGet submission |
| 150 | |
| 151 | The generated manifests are ready to copy into a `winget-pkgs` checkout under: |
| 152 | |
| 153 | ```text |
| 154 | manifests/b/BYVoid/OpenCC/<version>/ |
| 155 | ``` |
| 156 | |
| 157 | Recommended validation flow in a `winget-pkgs` clone: |
| 158 | |
| 159 | ```powershell |
| 160 | winget validate manifests\b\BYVoid\OpenCC\<version> |
| 161 | winget install --manifest manifests\b\BYVoid\OpenCC\<version> |
| 162 | ``` |
| 163 | |
| 164 | If you later automate WinGet submission, the generated manifest directory can be used directly as the source payload for a PR bot or `wingetcreate update`. |