mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Update NSIS guide. Backport docs to .34. Fix references. Fix titles.
This commit is contained in:
@@ -141,21 +141,11 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||
if dependenciesAvailableOptional != 0 {
|
||||
logger.Println("Optional package(s) installation details: \n" + info.Dependencies.InstallAllOptionalCommand())
|
||||
}
|
||||
//
|
||||
//if len(externalPackages) > 0 {
|
||||
// for _, p := range externalPackages {
|
||||
// if p.Optional {
|
||||
// print("[Optional] ")
|
||||
// }
|
||||
// logger.Println("Install " + p.Name + ": " + p.InstallCommand)
|
||||
// }
|
||||
//}
|
||||
|
||||
if len(dependenciesMissing) != 0 {
|
||||
// TODO: Check if apps are available locally and if so, adjust the diagnosis
|
||||
logger.Println("Fatal:")
|
||||
logger.Println("Required dependencies missing: " + strings.Join(dependenciesMissing, " "))
|
||||
logger.Println("Please read this article on how to resolve this: https://wails.app/guides/resolving-missing-packages")
|
||||
logger.Println("Please read this article on how to resolve this: https://wails.io/guides/resolving-missing-packages")
|
||||
}
|
||||
|
||||
logger.Println("")
|
||||
|
||||
@@ -160,7 +160,7 @@ func Load(projectPath string) (*Project, error) {
|
||||
result.Info.Copyright = &v
|
||||
}
|
||||
if result.Info.Comments == nil {
|
||||
v := "Built using Wails (https://wails.app)"
|
||||
v := "Built using Wails (https://wails.io)"
|
||||
result.Info.Comments = &v
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<key>CFBundleExecutable</key><string>{{.Title}}</string>
|
||||
<key>CFBundleIdentifier</key><string>com.wails.{{.Title}}</string>
|
||||
<key>CFBundleVersion</key><string>1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key><string>Built using Wails (https://wails.app)</string>
|
||||
<key>CFBundleGetInfoString</key><string>Built using Wails (https://wails.io)</string>
|
||||
<key>CFBundleShortVersionString</key><string>1.0.0</string>
|
||||
<key>CFBundleIconFile</key><string>iconfile</string>
|
||||
<key>LSMinimumSystemVersion</key><string>10.13.0</string>
|
||||
|
||||
@@ -61,7 +61,8 @@ import TabItem from "@theme/TabItem";
|
||||
<TabItem value="Linux">Linux required the standard <code>gcc</code> build tools plus <code>libgtk3</code> and <code>libwebkit</code>.
|
||||
Rather than list a ton of commands for different distros, Wails can try to determine
|
||||
what the installation commands are for your specific distribution. Run <code>wails doctor</code> after installation
|
||||
to be shown how to install the dependencies.</TabItem>
|
||||
to be shown how to install the dependencies.
|
||||
If your distro/package manager is not supported, please consult the <a href="/docs/guides/linux-distro-support"> Add Linux Distro</a> guide.</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Optional Dependencies
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
# Manual builds
|
||||
# Manual Builds
|
||||
|
||||
The Wails CLI does a lot of heavy lifting for the project, but sometimes it's desirable to manually build your project.
|
||||
This document will discuss the different operations the CLI does and how this may be achieved in different ways.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Code signing on GitHub Actions
|
||||
# Code Signing
|
||||
|
||||
This is a guide on how you can sign your binaries generated with Wails on macOS and Windows.
|
||||
This is a guide on how you can sign your binaries generated with Wails on MacOS and Windows.
|
||||
The guide will target CI environments, more specifically GitHub Actions.
|
||||
|
||||
## Windows
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
# You may need to manually build you frontend manually here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build wails app
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: upload artifacts macOS
|
||||
@@ -82,7 +82,7 @@ Now we're ready to implement the signing in our workflow using one of the two me
|
||||
### Method 1: signing with commands
|
||||
This method uses PowerShell commands to sign our app, and leaves you control over the entire signing process.
|
||||
|
||||
After the `"Build wails app"` step, we can add the following step to our workflow:
|
||||
After the `"Build Wails app"` step, we can add the following step to our workflow:
|
||||
```yaml
|
||||
- name: Sign Windows binaries
|
||||
if: matrix.platform == 'windows-latest'
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
# You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build wails app
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: Sign Windows binaries
|
||||
@@ -203,7 +203,7 @@ jobs:
|
||||
# You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build wails app
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: upload artifacts macOS
|
||||
@@ -223,7 +223,7 @@ jobs:
|
||||
For code signing on macOS, [gon](https://github.com/mitchellh/gon) is a very handy tool for code signing and communicating with Apple servers, also written in Go, and
|
||||
will be used in this guide.
|
||||
|
||||
After the `Build wails app` step, add the following to the workflow:
|
||||
After the `Build Wails app` step, add the following to the workflow:
|
||||
```yaml
|
||||
- name: MacOS download gon for code signing and app notarization
|
||||
if: matrix.platform == 'macos-latest'
|
||||
@@ -247,7 +247,7 @@ Now we need to configure some gon config files in our `build/darwin` directory:
|
||||
}
|
||||
}
|
||||
```
|
||||
Where `source` is your wails binary, `bundle_id` is your bundle ID, `apple_id` contains your Apple ID username and App-Specific password
|
||||
Where `source` is your Wails binary, `bundle_id` is your bundle ID, `apple_id` contains your Apple ID username and App-Specific password
|
||||
which you created earlier, and `sign.application_identity` is your identity which you can find by running the following command:
|
||||
```bash
|
||||
security find-identity -v -p codesigning
|
||||
@@ -293,7 +293,7 @@ Here's an example `Info.plist` file:
|
||||
</dict></plist>
|
||||
```
|
||||
|
||||
Now we're ready to add the signing step in our workflow after building the wails app:
|
||||
Now we're ready to add the signing step in our workflow after building the Wails app:
|
||||
```yaml
|
||||
- name: Import Code-Signing Certificates for macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
@@ -339,7 +339,7 @@ jobs:
|
||||
# You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build wails app
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: MacOS download gon for code signing and app notarization
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Building NSIS installer
|
||||
|
||||
Wails supports generating Windows installers using the [NSIS installer](https://nsis.sourceforge.io/).
|
||||
# NSIS installer
|
||||
|
||||
<p style={{"text-align": "center"}}>
|
||||
<img src="/img/nsis.png"></img><br/>
|
||||
<img src="/img/nsis.png" style={{"max-width":"50%"}}></img><br/>
|
||||
</p>
|
||||
|
||||
Wails supports generating Windows installers using the [NSIS installer](https://nsis.sourceforge.io/).
|
||||
|
||||
## Installing NSIS
|
||||
|
||||
### Windows
|
||||
@@ -29,17 +29,17 @@ NSIS is available to install through homebrew: `brew install nsis`.
|
||||
|
||||
## Generating the installer
|
||||
|
||||
When a new project is created, Wails generates a `.nsi` installer script in `build/windows/installer`. The config
|
||||
data is read from the project's `wails.json` so you can use this to configure the installer:
|
||||
When a new project is created, Wails generates the NSIS configuration files in `build/windows/installer`. The config
|
||||
data is read from `installer/info.json` and that is configured to use the project's `wails.json` Info section:
|
||||
|
||||
```json
|
||||
// ...
|
||||
"Info": {
|
||||
"companyName": "wailsvite",
|
||||
"productName": "wailsvite",
|
||||
"companyName": "My Company Name",
|
||||
"productName": "Wails Vite",
|
||||
"productVersion": "1.0.0",
|
||||
"copyright": "Copyright.........",
|
||||
"comments": "Built using Wails (https://wails.app)"
|
||||
"comments": "Built using Wails (https://wails.io)"
|
||||
},
|
||||
```
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ import TabItem from "@theme/TabItem";
|
||||
<TabItem value="Linux">Linux required the standard <code>gcc</code> build tools plus <code>libgtk3</code> and <code>libwebkit</code>.
|
||||
Rather than list a ton of commands for different distros, Wails can try to determine
|
||||
what the installation commands are for your specific distribution. Run <code>wails doctor</code> after installation
|
||||
to be shown how to install the dependencies.</TabItem>
|
||||
to be shown how to install the dependencies.
|
||||
If your distro/package manager is not supported, please consult the <a href="/docs/guides/linux-distro-support"> Add Linux Distro</a> guide.</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Optional Dependencies
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
|
||||
# Linux Distro Support
|
||||
|
||||
## Overview
|
||||
|
||||
Wails offers Linux support but providing installation instructions for all available distributions is an impossible task.
|
||||
Instead, Wails tries to determine if the packages you need to develop applications are available via your system's package
|
||||
manager. Currently, we support the following package managers:
|
||||
|
||||
- apt
|
||||
- dnf
|
||||
- emerge
|
||||
- eopkg
|
||||
- pacman
|
||||
- zypper
|
||||
|
||||
## Adding package names
|
||||
|
||||
There may be circumstances where your distro uses one of the supported package managers but the package name
|
||||
is different. For example, you may use an Ubuntu derivative, but the package name for gtk may be different. Wails
|
||||
attempts to find the correct package by iterating through a list of package names.
|
||||
The list of packages are stored in the packagemanager specific file in the `v2/internal/system/packagemanager`
|
||||
directory. In our example, this would be `v2/internal/system/packagemanager/apt.go`.
|
||||
|
||||
In this file, the list of packages are defined by the `Packages()` method:
|
||||
|
||||
```go
|
||||
func (a *Apt) Packages() packagemap {
|
||||
return packagemap{
|
||||
"libgtk-3": []*Package{
|
||||
{Name: "libgtk-3-dev", SystemPackage: true, Library: true},
|
||||
},
|
||||
"libwebkit": []*Package{
|
||||
{Name: "libwebkit2gtk-4.0-dev", SystemPackage: true, Library: true},
|
||||
},
|
||||
"gcc": []*Package{
|
||||
{Name: "build-essential", SystemPackage: true},
|
||||
},
|
||||
"pkg-config": []*Package{
|
||||
{Name: "pkg-config", SystemPackage: true},
|
||||
},
|
||||
"npm": []*Package{
|
||||
{Name: "npm", SystemPackage: true},
|
||||
},
|
||||
"docker": []*Package{
|
||||
{Name: "docker.io", SystemPackage: true, Optional: true},
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Let's assume that in our linux distro, `libgtk-3` is packaged under the name `lib-gtk3-dev`.
|
||||
We could add support for this by adding the following line:
|
||||
|
||||
```go {5}
|
||||
func (a *Apt) Packages() packagemap {
|
||||
return packagemap{
|
||||
"libgtk-3": []*Package{
|
||||
{Name: "libgtk-3-dev", SystemPackage: true, Library: true},
|
||||
{Name: "lib-gtk3-dev", SystemPackage: true, Library: true},
|
||||
},
|
||||
"libwebkit": []*Package{
|
||||
{Name: "libwebkit2gtk-4.0-dev", SystemPackage: true, Library: true},
|
||||
},
|
||||
"gcc": []*Package{
|
||||
{Name: "build-essential", SystemPackage: true},
|
||||
},
|
||||
"pkg-config": []*Package{
|
||||
{Name: "pkg-config", SystemPackage: true},
|
||||
},
|
||||
"npm": []*Package{
|
||||
{Name: "npm", SystemPackage: true},
|
||||
},
|
||||
"docker": []*Package{
|
||||
{Name: "docker.io", SystemPackage: true, Optional: true},
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Adding new package managers
|
||||
|
||||
To add a new package manager, perform the following steps:
|
||||
|
||||
- Create a new file in `v2/internal/system/packagemanager` called `<pm>.go`, where `<pm>` is the name of the package manager.
|
||||
- Define a struct that conforms to the package manager interface defined in `pm.go`:
|
||||
|
||||
```go
|
||||
type PackageManager interface {
|
||||
Name() string
|
||||
Packages() packagemap
|
||||
PackageInstalled(*Package) (bool, error)
|
||||
PackageAvailable(*Package) (bool, error)
|
||||
InstallCommand(*Package) string
|
||||
}
|
||||
```
|
||||
- `Name()` should return the name of the package manager
|
||||
- `Packages()` should return a `packagemap`, that provides candidate filenames for dependencies
|
||||
- `PackageInstalled()` should return `true` if the given package is installed
|
||||
- `PackageAvailable()` should return `true` if the given package is not installed but available for installation
|
||||
- `InstallCommand()` should return the exact command to install the given package name
|
||||
|
||||
Take a look at the other package managers code to get an idea how this works.
|
||||
|
||||
:::info Remember
|
||||
If you add support for a new package manager, don't forget to also update this page!
|
||||
:::
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
# Manual builds
|
||||
# Manual Builds
|
||||
|
||||
The Wails CLI does a lot of heavy lifting for the project, but sometimes it's desirable to manually build your project.
|
||||
This document will discuss the different operations the CLI does and how this may be achieved in different ways.
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
# Code Signing
|
||||
|
||||
This is a guide on how you can sign your binaries generated with Wails on MacOS and Windows.
|
||||
The guide will target CI environments, more specifically GitHub Actions.
|
||||
|
||||
## Windows
|
||||
First off you need a code signing certificate. If you do not already have one, Microsoft's
|
||||
info page lists some providers [here](https://docs.microsoft.com/en-us/windows-hardware/drivers/dashboard/get-a-code-signing-certificate).
|
||||
Please note that an EV certificate is not required unless you need to write kernel-level
|
||||
software such as device drivers. For signing your Wails app, a standard code signing
|
||||
certificate will do just fine.
|
||||
|
||||
It may be a good idea to check with your certificate provider
|
||||
how to sign your binaries on your local machine before targeting automated build systems, just so you know if there
|
||||
are any special requirements. For instance, [here](https://www.ssl.com/how-to/using-your-code-signing-certificate/) is SSL.com's code signing guide for Windows.
|
||||
If you know how to sign locally, it will be easier to
|
||||
troubleshoot any potential issues in a CI environment.
|
||||
For instance, SSL.com code signing certificates require the `/tr` flag for [SignTool.exe](https://docs.microsoft.com/en-us/windows/win32/seccrypto/signtool)
|
||||
while other providers may only need the `/t` flag for providing the timestamping server. Popular GitHub Actions for signing
|
||||
Windows binaries like [this one](https://github.com/Dana-Prajea/code-sign-action) does not support the `/tr` flag on SignTool.exe.
|
||||
Therefore this guide will focus on signing our app manually with PowerShell commands, but you can use actions like the [code-sign-action](https://github.com/Dana-Prajea/code-sign-action)
|
||||
Action if you prefer.
|
||||
|
||||
First off, let's make sure we are able to build our Wails app in our GitHub CI. Here is a small workflow template:
|
||||
```yaml
|
||||
name: "example"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# This Action only starts when you go to Actions and manually run the workflow.
|
||||
|
||||
jobs:
|
||||
package:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ windows-latest, macos-latest ]
|
||||
go-version: [1.18]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
# You may need to manually build you frontend manually here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: upload artifacts macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-macos
|
||||
path: build/bin/*
|
||||
- name: upload artifacts windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-windows
|
||||
path: build/bin/*
|
||||
```
|
||||
|
||||
Next we need to give the GitHub workflow access to our signing certificate. This is done by encoding your .pfx or .p12 certificate
|
||||
into a base64 string. To do this in PowerShell, you can use the following command assuming your certificate is called 'my-cert.p12':
|
||||
```PowerShell
|
||||
certutil -encode .\my-cert.p12 my-cert-base64.txt
|
||||
```
|
||||
|
||||
You should now have your .txt file with the base64 encoded certificate. It should start with *-----BEGIN CERTIFICATE-----* and
|
||||
end with *-----END CERTIFICATE-----*. Now you need to make two action secrets on GitHub. Navigate to *Settings -> Secrets -> Actions* and create the
|
||||
two following secrets:
|
||||
* **WIN_SIGNING_CERT** with the contents of your base64 encoded certificate text.
|
||||
* **WIN_SIGNING_CERT_PASSWORD** with the contents of your certificate password.
|
||||
|
||||
Now we're ready to implement the signing in our workflow using one of the two methods:
|
||||
|
||||
### Method 1: signing with commands
|
||||
This method uses PowerShell commands to sign our app, and leaves you control over the entire signing process.
|
||||
|
||||
After the `"Build Wails app"` step, we can add the following step to our workflow:
|
||||
```yaml
|
||||
- name: Sign Windows binaries
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: |
|
||||
echo "Creating certificate file"
|
||||
New-Item -ItemType directory -Path certificate
|
||||
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
|
||||
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
||||
echo "Signing our binaries"
|
||||
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd <signing algorithm> /t <timestamping server> /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' <path to binary>
|
||||
|
||||
```
|
||||
This script creates a new directory for your certificate file, creates the certificate file from our base64 secret, converts it to a .pfx file,
|
||||
and finally signs the binary. The following variables needs to be replaced in the last line:
|
||||
* **signing algorithm**: usually sha256.
|
||||
* **timestamping server**: URL to the timestamping server to use with your certificate.
|
||||
* **path to binary**: path to the binary you want to sign.
|
||||
|
||||
Given that our Wails config has `outputfilename` set to "app.exe" and that we have a certificate from SSL.com, this would be our workflow:
|
||||
```yaml
|
||||
name: "example"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# This Action only starts when you go to Actions and manually run the workflow.
|
||||
|
||||
jobs:
|
||||
package:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ windows-latest, macos-latest ]
|
||||
go-version: [1.18]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
# You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: Sign Windows binaries
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: |
|
||||
echo "Creating certificate file"
|
||||
New-Item -ItemType directory -Path certificate
|
||||
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
|
||||
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
||||
echo "Signing our binaries"
|
||||
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\app.exe
|
||||
|
||||
- name: upload artifacts macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-macos
|
||||
path: build/bin/*
|
||||
- name: upload artifacts windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-windows
|
||||
path: build/bin/*
|
||||
```
|
||||
|
||||
### Method 2: automatically signing with Action
|
||||
It is possible to use a Windows code signing Action like [this](https://github.com/marketplace/actions/code-sign-a-file-with-pfx-certificate) one,
|
||||
but note it requires a SHA1 hash for the certificate and a certificate name. View an example of how to configure it on the Action's [marketplace](https://github.com/marketplace/actions/code-sign-a-file-with-pfx-certificate).
|
||||
|
||||
---
|
||||
|
||||
## MacOS
|
||||
|
||||
First off you need your code signing certificate from Apple. If you do not have one, a simple Google search will help you acquire one.
|
||||
Once you have your certificate, you need to export it and encode it to base64. [This tutorial](https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions)
|
||||
shows you how to do that in an easy manner. Once you have exported your .p12 certificate file, you can encode it to base64 as seen in the tutorial with the following command:
|
||||
```bash
|
||||
base64 Certificates.p12 | pbcopy
|
||||
```
|
||||
|
||||
Now you're ready to create some GitHub project secrets, just as with Windows:
|
||||
* **APPLE_DEVELOPER_CERTIFICATE_P12_BASE64** with the contents of your newly copied base64 certificate.
|
||||
* **APPLE_DEVELOPER_CERTIFICATE_PASSWORD** with the contents of your certificate password.
|
||||
* **APPLE_PASSWORD** with the contents of an App-Specific password to your Apple-ID account which you can generate [here](https://appleid.apple.com/account/manage).
|
||||
|
||||
Let's make sure we are able to build our Wails app in our GitHub Action workflow. Here is a small template:
|
||||
|
||||
```yaml
|
||||
name: "example"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# This Action only starts when you go to Actions and manually run the workflow.
|
||||
|
||||
jobs:
|
||||
package:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ windows-latest, macos-latest ]
|
||||
go-version: [1.18]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
# You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: upload artifacts macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-macos
|
||||
path: build/bin/*
|
||||
- name: upload artifacts windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-windows
|
||||
path: build/bin/*
|
||||
```
|
||||
|
||||
For code signing on macOS, [gon](https://github.com/mitchellh/gon) is a very handy tool for code signing and communicating with Apple servers, also written in Go, and
|
||||
will be used in this guide.
|
||||
|
||||
After the `Build Wails app` step, add the following to the workflow:
|
||||
```yaml
|
||||
- name: MacOS download gon for code signing and app notarization
|
||||
if: matrix.platform == 'macos-latest'
|
||||
run: |
|
||||
brew install mitchellh/gon/gon
|
||||
```
|
||||
|
||||
Now we need to configure some gon config files in our `build/darwin` directory:
|
||||
|
||||
1. gon-sign.json:
|
||||
```json
|
||||
{
|
||||
"source" : ["./build/bin/app.app"],
|
||||
"bundle_id" : "app.myapp",
|
||||
"apple_id": {
|
||||
"username": "my-appleid@email.com",
|
||||
"password": "@env:APPLE_PASSWORD"
|
||||
},
|
||||
"sign" :{
|
||||
"application_identity" : "Developer ID Application: My Name"
|
||||
}
|
||||
}
|
||||
```
|
||||
Where `source` is your Wails binary, `bundle_id` is your bundle ID, `apple_id` contains your Apple ID username and App-Specific password
|
||||
which you created earlier, and `sign.application_identity` is your identity which you can find by running the following command:
|
||||
```bash
|
||||
security find-identity -v -p codesigning
|
||||
```
|
||||
2. entitlements.plist:
|
||||
```plist
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.downloads.read-write</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
```
|
||||
In this file you configure the entitlements you need for you app, e.g. camera permissions if your app uses the camera. Read more about entitlements [here](https://developer.apple.com/documentation/bundleresources/entitlements).
|
||||
|
||||
Make sure you have updated your `Info.plist` file with the same bundle ID as you entered in `gon-sign.json`.
|
||||
Here's an example `Info.plist` file:
|
||||
```plist
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict>
|
||||
<key>CFBundlePackageType</key><string>APPL</string>
|
||||
<key>CFBundleName</key><string>MyApp</string>
|
||||
<key>CFBundleExecutable</key><string>app</string>
|
||||
<key>CFBundleIdentifier</key><string>app.myapp</string>
|
||||
<key>CFBundleVersion</key><string>0.1.0</string>
|
||||
<key>CFBundleGetInfoString</key><string>My app is cool and nice and chill and</string>
|
||||
<key>CFBundleShortVersionString</key><string>0.1.0</string>
|
||||
<key>CFBundleIconFile</key><string>iconfile</string>
|
||||
<key>LSMinimumSystemVersion</key><string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key><string>true</string>
|
||||
<key>LSApplicationCategoryType</key><string>public.app-category.utilities</string>
|
||||
<key>NSHumanReadableCopyright</key><string>© Me</string>
|
||||
</dict></plist>
|
||||
```
|
||||
|
||||
Now we're ready to add the signing step in our workflow after building the Wails app:
|
||||
```yaml
|
||||
- name: Import Code-Signing Certificates for macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: Apple-Actions/import-codesign-certs@v1
|
||||
with:
|
||||
# The certificates in a PKCS12 file encoded as a base64 string
|
||||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
||||
# The password used to import the PKCS12 file.
|
||||
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
|
||||
- name: Sign our macOS binary
|
||||
if: matrix.platform == 'macos-latest'
|
||||
run: |
|
||||
echo "Signing Package"
|
||||
gon -log-level=info ./build/darwin/gon-sign.json
|
||||
```
|
||||
Please note that signing binaries with Apple could take anywhere from minutes to hours.
|
||||
|
||||
## Combined workflow file:
|
||||
Here is our GitHub workflow file with Windows + macOS combined:
|
||||
```yaml
|
||||
name: "example combined"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# This Action only starts when you go to Actions and manually run the workflow.
|
||||
|
||||
jobs:
|
||||
package:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ windows-latest, macos-latest ]
|
||||
go-version: [1.18]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
# You may need to manually build you frontend here, unless you have configured frontend build and install commands in wails.json.
|
||||
- name: Get Wails
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
wails build
|
||||
- name: MacOS download gon for code signing and app notarization
|
||||
if: matrix.platform == 'macos-latest'
|
||||
run: |
|
||||
brew install mitchellh/gon/gon
|
||||
- name: Import Code-Signing Certificates for macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: Apple-Actions/import-codesign-certs@v1
|
||||
with:
|
||||
# The certificates in a PKCS12 file encoded as a base64 string
|
||||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
||||
# The password used to import the PKCS12 file.
|
||||
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
|
||||
- name: Sign our macOS binary
|
||||
if: matrix.platform == 'macos-latest'
|
||||
run: |
|
||||
echo "Signing Package"
|
||||
gon -log-level=info ./build/darwin/gon-sign.json
|
||||
- name: Sign Windows binaries
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: |
|
||||
echo "Creating certificate file"
|
||||
New-Item -ItemType directory -Path certificate
|
||||
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
|
||||
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
||||
echo "Signing our binaries"
|
||||
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\Monitor.exe
|
||||
- name: upload artifacts macOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-macos
|
||||
path: build/bin/*
|
||||
- name: upload artifacts windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: wails-binaries-windows
|
||||
path: build/bin/*
|
||||
```
|
||||
|
||||
# End notes
|
||||
This guide inspired by the RiftShare project and its workflow, which is highly recommended to check out [here](https://github.com/achhabra2/riftshare/blob/main/.github/workflows/build.yaml).
|
||||
@@ -0,0 +1,51 @@
|
||||
# NSIS installer
|
||||
|
||||
<p style={{"text-align": "center"}}>
|
||||
<img src="/img/nsis.png" style={{"max-width":"50%"}}></img><br/>
|
||||
</p>
|
||||
|
||||
Wails supports generating Windows installers using the [NSIS installer](https://nsis.sourceforge.io/).
|
||||
|
||||
## Installing NSIS
|
||||
|
||||
### Windows
|
||||
|
||||
The installer is available on the [NSIS Download](https://nsis.sourceforge.io/Download) page.
|
||||
|
||||
If you use the chocolatey package manager, run the following script:
|
||||
```
|
||||
choco install nsis
|
||||
```
|
||||
If you install NSIS manually, you need to add the *Bin* folder, which contains `makensis.exe`, in your NSIS installation to your path.
|
||||
[Here](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/) is a good tutorial on how to add to path on Windows.
|
||||
|
||||
### Linux
|
||||
|
||||
The `nsis` package should be available through your distribution's package manager.
|
||||
|
||||
### MacOS
|
||||
|
||||
NSIS is available to install through homebrew: `brew install nsis`.
|
||||
|
||||
## Generating the installer
|
||||
|
||||
When a new project is created, Wails generates the NSIS configuration files in `build/windows/installer`. The config
|
||||
data is read from `installer/info.json` and that is configured to use the project's `wails.json` Info section:
|
||||
|
||||
```json
|
||||
// ...
|
||||
"Info": {
|
||||
"companyName": "My Company Name",
|
||||
"productName": "Wails Vite",
|
||||
"productVersion": "1.0.0",
|
||||
"copyright": "Copyright.........",
|
||||
"comments": "Built using Wails (https://wails.io)"
|
||||
},
|
||||
```
|
||||
|
||||
To generate an installer for your application, use the `-nsis` flag with `wails build`:
|
||||
```
|
||||
wails build -nsis
|
||||
```
|
||||
|
||||
The installer will now be available in the `build/bin` directory.
|
||||
Reference in New Issue
Block a user