|
1 | | -# dAppCore/build@v4 |
| 1 | +# dAppCore/build |
2 | 2 |
|
3 | 3 | [](https://github.com/dAppCore/build/actions/workflows/ci.yml) |
4 | | -[](LICENSE) |
| 4 | +[](LICENSE) |
5 | 5 |
|
6 | | -> [!NOTE] |
7 | | -> For comprehensive documentation, please visit the [docs](docs/) directory. |
8 | | -
|
9 | | - |
10 | | -> I help on lots of open source projects, im tired of doing the same thing over and over again.\ |
11 | | -> so, I'm going to put them all together in one place.\ |
12 | | -> Hopefully it will help you too. |
13 | | -
|
14 | | -General build action (multi-stack). |
15 | | - |
16 | | -By default, the root action will best guess the builds you might want to run and delegate to the appropriate sub-action. You can also explicitly select a stack and enable/disable setup steps. |
17 | | - |
18 | | -you should write out an action that cherry-picks the parts you need; the auto-detected method works for me, based on the file structures in the tdd/* folders |
19 | | - |
20 | | -# Default build |
21 | | -```yaml |
22 | | -- uses: dAppCore/build@v4 |
23 | | - with: |
24 | | - build-name: wailsApp |
25 | | - build-platform: linux/amd64 |
26 | | -``` |
27 | | -
|
28 | | -## Build with No uploading |
| 6 | +One GitHub Action that reads your repository, works out what it is, and builds |
| 7 | +it — Wails v3, Wails v2, or a plain Go binary, on Linux, macOS and Windows. |
29 | 8 |
|
30 | 9 | ```yaml |
| 10 | +- uses: actions/checkout@v4 |
31 | 11 | - uses: dAppCore/build@v4 |
32 | 12 | with: |
33 | | - build-name: wailsApp |
34 | | - build-platform: linux/amd64 |
35 | | - package: false |
| 13 | + build-name: myApp |
36 | 14 | ``` |
37 | | -## Inputs (high level) |
38 | | -
|
39 | | -This repository is multi-stack. The root action detects the stack and delegates; Wails v2 is the fallback when detection finds nothing it recognises. For stack-specific inputs and examples, see the wrapper README beside each stack. |
40 | 15 |
|
41 | | -Common high-level inputs on the root action include: |
42 | | -- `build-name` — required; base name for outputs |
43 | | -- `build-platform` — target platform (e.g., `linux/amd64`, `windows/amd64`, `darwin/universal`) |
44 | | -- `build` — whether to build (default `true`) |
45 | | -- `package` — upload artifacts and (on tags) publish a release (default `true`) |
46 | | -- `sign` — enable platform signing when configured (default `false`) |
| 16 | +That detects the stack, installs the toolchains, builds, uploads the result as |
| 17 | +a workflow artifact, and publishes a GitHub release when the ref is a tag. |
47 | 18 |
|
48 | | -Stack-specific inputs (Wails flags, signing certs, etc.) are documented in the Wails v2 wrapper: `actions/wails2/README.md`. |
| 19 | +## Contents |
49 | 20 |
|
| 21 | +| | | |
| 22 | +| :-- | :-- | |
| 23 | +| [Quickstart](https://dappco.re/build/quickstart/) | The matrix build, build-only, and apps not at the repository root | |
| 24 | +| [How detection works](https://dappco.re/build/detection/) | What it reads, what it concludes, how to overrule it | |
| 25 | +| [Wails v3](https://dappco.re/build/stacks/wails3/) | Runs your Taskfile target — so CI takes the path you do | |
| 26 | +| [Wails v2](https://dappco.re/build/stacks/wails2/) | Composes `wails build` flags from inputs | |
| 27 | +| [Go binaries](https://dappco.re/build/stacks/core/) | A Go project with no frontend | |
| 28 | +| [Inputs](https://dappco.re/build/reference/inputs/) | Every input, on the root action and each wrapper | |
| 29 | +| [Sub-actions](https://dappco.re/build/reference/sub-actions/) | Discovery, setup, build, sign and package, each callable alone | |
| 30 | +| [Packaging & releases](https://dappco.re/build/reference/packaging/) | Artifact naming, and what a tag changes | |
| 31 | +| [Code signing](https://dappco.re/build/reference/signing/) | macOS notarisation and Windows signtool | |
50 | 32 |
|
| 33 | +### Three platforms |
51 | 34 |
|
52 | | -## Examples and stack-specific docs |
| 35 | +Nothing about the action changes per runner. The matrix does the work. |
53 | 36 |
|
54 | | -For Wails v2 end-to-end usage, examples, and advanced options, see: |
55 | | -- Wails v2 wrapper: `actions/build/wails2/README.md` |
56 | | -- Wails build sub-action: `actions/build/wails2/build/README.md` |
57 | | - |
58 | | -The root README focuses on multi-stack concepts. Stack-specific workflows are documented alongside each stack. |
59 | | - |
60 | | -## macOS code signing docs moved |
61 | | - |
62 | | -The detailed macOS code signing and notarization guide (including `gon` JSON examples and `entitlements.plist`) now lives with the Wails v2 stack docs: |
63 | | -- See `actions/build/wails2/README.md` → “macOS Code Signing (Wails v2)” |
64 | | - |
65 | | - |
66 | | -## Configure Deno via environment variables (optional) |
67 | | - |
68 | | -Deno is not required. If you want to run a Deno build/asset step before Wails, you can configure it entirely via env vars — no `deno-*` inputs are needed. |
69 | | - |
70 | | -Precedence used by the action (inside `actions/setup`): |
71 | | -- Environment variables > action inputs > defaults. |
72 | | -- If nothing is provided, Deno is skipped. |
73 | | - |
74 | | -Supported variables: |
75 | | -- `DENO_ENABLE` — `true`/`1`/`yes`/`on` explicitly enables Deno even without a build command. |
76 | | -- `DENO_BUILD` — full command to run (e.g., `deno task build`, `deno run -A build.ts`). |
77 | | -- `DENO_VERSION` — e.g., `v1.44.x`. |
78 | | -- `DENO_WORKDIR` — working directory for the Deno command (default `.`). |
79 | | -- Pass-throughs (used by Deno if present): `DENO_AUTH_TOKEN`, `DENO_DIR`, `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`, etc. |
80 | | - |
81 | | -Example (job-level env): |
82 | 37 | ```yaml |
83 | | -jobs: |
84 | | - build: |
85 | | - runs-on: ubuntu-latest |
86 | | - env: |
87 | | - DENO_ENABLE: 'true' |
88 | | - DENO_VERSION: 'v1.44.x' |
89 | | - DENO_WORKDIR: 'frontend' |
90 | | - DENO_BUILD: 'deno task build' |
91 | | - steps: |
92 | | - - uses: actions/checkout@v4 |
93 | | - - uses: dAppCore/build@v4 |
94 | | - with: |
95 | | - build-name: wailsApp |
96 | | - build-platform: linux/amd64 |
| 38 | +strategy: |
| 39 | + matrix: |
| 40 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 41 | +runs-on: ${{ matrix.os }} |
| 42 | +steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + - uses: dAppCore/build@v4 |
| 45 | + with: |
| 46 | + build-name: myApp |
97 | 47 | ``` |
98 | 48 |
|
99 | | -Using `$GITHUB_ENV` in a prior step: |
| 49 | +### Build without publishing |
| 50 | + |
100 | 51 | ```yaml |
101 | | -- name: Configure Deno via $GITHUB_ENV |
102 | | - run: | |
103 | | - echo "DENO_ENABLE=true" >> "$GITHUB_ENV" |
104 | | - echo "DENO_VERSION=v1.44.x" >> "$GITHUB_ENV" |
105 | | - echo "DENO_WORKDIR=frontend" >> "$GITHUB_ENV" |
106 | | - echo "DENO_BUILD=deno task build" >> "$GITHUB_ENV" |
107 | 52 | - uses: dAppCore/build@v4 |
108 | 53 | with: |
109 | | - build-name: wailsApp |
110 | | - build-platform: linux/amd64 |
111 | | -``` |
112 | | - |
113 | | -Secrets example (private modules): |
114 | | -```yaml |
115 | | -env: |
116 | | - DENO_AUTH_TOKEN: ${{ secrets.DENO_AUTH_TOKEN }} |
| 54 | + build-name: myApp |
| 55 | + package: false |
117 | 56 | ``` |
118 | 57 |
|
119 | | - |
120 | | -## Sub-actions overview |
121 | | - |
122 | | -This repo is modular. You can call the root action, the Wails v2 wrapper, or any sub-action directly. |
123 | | - |
124 | | -- actions/discovery — detects OS/ARCH, Ubuntu version on Linux, and exposes repo/ref metadata. |
125 | | -- actions/options — computes `BUILD_OPTIONS` (adds `-tags webkit2_41` on Ubuntu 24.04 when appropriate). |
126 | | -- actions/setup — orchestrator that delegates to: |
127 | | - - actions/setup/go — Go, optional Garble, Wails CLI, and `gon` on macOS. |
128 | | - - actions/setup/npm — Node.js and npm install/ci in your app working directory. |
129 | | - - actions/setup/deno — optional; ENV-first Deno setup and command runner. |
130 | | - - actions/setup/conan — placeholder for future C++ builds. |
131 | | -- actions/build/wails2/build — runs `wails build` and fixes executable permissions per-OS. |
132 | | -- actions/build/wails3/build — runs the project's Taskfile target through `go tool wails3` and fixes executable permissions per-OS. |
133 | | -- actions/sign — unified macOS and Windows signing; notarizes on tags. |
134 | | -- actions/package — uploads artifacts; on tags, publishes a GitHub Release. |
135 | | - |
136 | | -## Stacks |
137 | | - |
138 | | -- Available: |
139 | | - - **wails3** — `uses: dAppCore/build/actions/build/wails3@v4` |
140 | | - - **wails2** — `uses: dAppCore/build/actions/build/wails2@v4` |
141 | | - - **core** — plain Go binaries, no frontend |
142 | | -- Coming soon: |
143 | | - - cpp — via `setup/conan` and dedicated build/sign/pack steps |
144 | | - |
145 | | -### wails2 or wails3? |
146 | | - |
147 | | -Detection reads the Go module, because that is the only place the two differ |
148 | | -unambiguously — both are Go plus a frontend. A module requiring `wails/v3` |
149 | | -selects the v3 stack; anything else with Go and a frontend selects v2. The |
150 | | -module is found at `go.mod` or `go/go.mod`, since keeping it one level down is |
151 | | -a normal layout rather than an exception. |
152 | | - |
153 | | -The stacks are not variations on each other. v2 takes build options as CLI |
154 | | -flags this action composes. v3 projects own a Taskfile, and wails3 runs targets |
155 | | -in it — so the v3 stack runs the project's own target rather than |
156 | | -reconstructing the command, and CI takes the same path a developer does. That |
157 | | -is why the v3 stack has no `build-platform` input: the Taskfile target and the |
158 | | -runner decide together, and offering a platform would be offering a choice the |
159 | | -stack cannot honour. |
| 58 | +### Pick the stack yourself |
160 | 59 |
|
161 | 60 | ```yaml |
162 | | -# wails3 — the Taskfile decides how; the runner decides which target |
163 | 61 | - uses: dAppCore/build@v4 |
164 | 62 | with: |
165 | 63 | build-name: myApp |
166 | | -
|
167 | | -# wails3, explicit target |
168 | | -- uses: dAppCore/build/actions/build/wails3@v4 |
169 | | - with: |
170 | | - build-name: myApp |
171 | | - task: linux:package |
| 64 | + STACK: wails3 |
172 | 65 | ``` |
173 | 66 |
|
174 | | -Linux runners get `libgtk-4-dev` and `libwebkitgtk-6.0-dev`. Wails v3 compiles |
175 | | -its GTK4 path unless the `gtk3` build tag is set, and installing the GTK3 pair |
176 | | -instead fails as `Package 'gtk4', required by 'virtual:world', not found` — |
177 | | -often at binding generation rather than at build, which reads as a frontend |
178 | | -problem. |
179 | | - |
180 | | -## Setup orchestrator notes |
181 | | - |
182 | | -The `actions/setup` sub-action is a thin orchestrator that runs Go → npm → Deno (optional) → Conan (optional). It keeps Deno independent from Wails. Configure Deno via environment variables (ENV-first), or via inputs as a fallback. See the Deno section below and `actions/setup/deno/README.md` for details. |
183 | | - |
184 | | -## Orchestrator controls (root action) |
185 | | - |
186 | | -The root action can auto-detect your stack and auto-enable setup steps. This makes `dAppCore/build@v4` “just work” for common layouts, while still allowing full control. |
187 | | - |
188 | | -- Inputs (root action): |
189 | | - - `AUTO_STACK` (default `true`) — auto-select a stack based on `actions/discovery` outputs. |
190 | | - - `AUTO_SETUP` (default `true`) — allow sub-setup enabling based on env toggles. |
191 | | - - `STACK` (optional) — force a stack (e.g., `wails2`). When set, it takes precedence over auto. |
192 | | -- Environment toggles (read when `AUTO_SETUP == true`): |
193 | | - - `ENABLE_GO`, `ENABLE_NPM`, `ENABLE_DENO`, `ENABLE_CONAN` — `true`/`1`/`yes`/`on` to explicitly enable those setups; otherwise defaults are used. |
194 | | -- Precedence and routing: |
195 | | - - If `STACK` is set, the root action routes to that stack wrapper directly. |
196 | | - - Else if `AUTO_STACK` is enabled, the root action uses `PRIMARY_STACK_SUGGESTION` from discovery and routes accordingly (currently `wails2`). |
197 | | - - You can fully opt out by setting `AUTO_STACK: 'false'` and `AUTO_SETUP: 'false'` and calling sub-actions directly in your workflow. |
198 | | -- Debug logs: |
199 | | - - Look for `[DEBUG_LOG] Auto stack=...` and `[DEBUG_LOG] npm-install resolved=...` in the logs to see decisions made. |
200 | | - |
201 | | -## Smarter artifact naming (package) |
202 | | - |
203 | | -Starting in v3, the `actions/package` sub-action composes a descriptive artifact name using discovery metadata: |
204 | | - |
205 | | -```text |
206 | | -<build-name>_<OS>_<ARCH>_<TAG|SHORTSHA> |
207 | | -``` |
208 | | - |
209 | | -- On tag builds, the tag (e.g., `v1.2.3`) is used. |
210 | | -- On branch/PR builds, the short commit SHA is used. |
211 | | -- Example: `wailsApp_Ubuntu-22.04_amd64_ab12cd3` or `wailsApp_macos_arm64_v1.2.3`. |
212 | | - |
213 | | -When you call the root action or the `wails2` wrapper, discovery outputs are passed automatically to `actions/package`. |
214 | | - |
215 | | - |
216 | | -## CI validations and gating |
| 67 | +Or call a stack directly: `dAppCore/build/actions/build/wails3@v4`. |
217 | 68 |
|
218 | | -The repository includes self-tests to surface issues early and gate app builds behind fast sub-action checks: |
219 | | -- Sub-action tests (gating): `discovery`, `options`, `setup/*` (go, npm, deno, conan), `sign` diagnostics, and `package` run first. App build jobs depend on these via `needs:` and will not execute if any sub-test fails. |
220 | | -- Packaging smoke (Ubuntu): runs the root action locally with `package: true` on branch/PR builds and verifies artifact upload. No release is created on non-tag refs. Look for `[DEBUG_LOG] ARTIFACT_NAME=...` in logs. |
221 | | -- Matrix builds with packaging: root action and the `wails2` wrapper run on Ubuntu/macOS/Windows with `package: true` on branches/PRs to confirm cross-OS uploads. Signing remains disabled. |
222 | | -- Signing diagnostics (dry-run): |
223 | | - - macOS: prints `gon --version` if available or guidance if not; always green. |
224 | | - - Windows: searches common Windows SDK locations for `signtool.exe` and logs the result; always green. |
| 69 | +--- |
225 | 70 |
|
226 | | -These checks run on `push`/`pull_request` to branches and are safe on forks (no secrets required). On tag refs, real releases are only created when your workflow explicitly runs and `refs/tags/*` is detected. |
| 71 | +**Full documentation: [dappco.re/build](https://dappco.re/build/)** |
227 | 72 |
|
228 | | -### Extending CI for new stacks (cpp) |
229 | | -- Mirror the pattern: create stack-specific sub-action tests (e.g., `setup/wails3`, `setup/conan`, stack-specific build options) that are fast and deterministic. |
230 | | -- Add the new test jobs to the app build job `needs:` so stack builds only run after sub-tests pass. |
231 | | -- Prefer dummy artifacts with the `actions/package` sub-action for packaging checks; keep releases tag-gated. |
232 | | -- Keep tests secrets-free; add tool presence diagnostics (similar to `gon`/`signtool`) for platform-specific tools. |
| 73 | +`@v4` follows the latest v4 release. Pin `@v4.1.0` to choose your own upgrades. |
0 commit comments