5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 08:10:56 +08:00

Describe a guide to build an app for all platforms in github actions (#2879)

* Describe a guide to build an app for all platforms in github actions

* Update changelog, remove tabs from an added guide

---------

Co-authored-by: Denis <denis@Deniss-Mac-mini.fritz.box>
This commit is contained in:
Denis Dvornikov 2023-09-20 00:12:57 +02:00 committed by GitHub
parent 34c725231c
commit eca6afc18c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,65 @@
# Crossplatform build with Github Actions
To build a Wails project for all the available platforms, you need to create an application build for each operating system. One effective method to achieve this is by utilizing GitHub Actions.
An action that facilitates building a Wails app is available at:
https://github.com/dAppServer/wails-build-action
In case the existing action doesn't fulfill your requirements, you can select only the necessary steps from the source:
https://github.com/dAppServer/wails-build-action/blob/main/action.yml
Below is a comprehensive example that demonstrates building an app upon the creation of a new Git tag and subsequently uploading it to the Actions artifacts:
```yaml
name: Wails build
on:
push:
tags:
# Match any new tag
- '*'
env:
# Necessary for most environments as build failure can occur due to OOM issues
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
build:
strategy:
# Failure in one platform build won't impact the others
fail-fast: false
matrix:
build:
- name: 'App'
platform: 'linux/amd64'
os: 'ubuntu-latest'
- name: 'App'
platform: 'windows/amd64'
os: 'windows-latest'
- name: 'App'
platform: 'darwin/universal'
os: 'macos-latest'
runs-on: ${{ matrix.build.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build wails
uses: dAppServer/wails-build-action@v2.2
id: build
with:
build-name: ${{ matrix.build.name }}
build-platform: ${{ matrix.build.platform }}
package: false
go-version: '1.20'
```
This example offers opportunities for various enhancements, including:
- Caching dependencies
- Code signing
- Uploading to platforms like S3, Supbase, etc.
- Injecting secrets as environment variables
- Utilizing environment variables as build variables (such as version variable extracted from the current Git tag)

View File

@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added new community template wails-sveltekit-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2851)
- Added support for print dialogs. Added by [@aangelisc](https://github.com/aangelisc) in [PR](https://github.com/wailsapp/wails/pull/2822)
- Added new `wails dev -nogorebuild` flag to prevent restarts on back end file changes. [@haukened](https://github.com/haukened) in [PR #2870](https://github.com/wailsapp/wails/pull/2870)
- Added a guide to describe a cross-platform build using GitHub Actions. Added by [@dennypenta](https://github.com/dennypenta) in [PR](https://github.com/wailsapp/wails/pull/2879)
### Changed