Skip to content

dont hardcode project name in build-actions #16

dont hardcode project name in build-actions

dont hardcode project name in build-actions #16

Workflow file for this run

name: Wails build
# inspired by https://github.com/dAppServer/wails-build-action/blob/main/action.yml
on: [push]
env:
# Necessary for most environments as build failure can occur due to OOM issues
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
build: [
{ name: 'ask-mai-linux-amd64', platform: linux/amd64, os: ubuntu-latest },
# { name: 'ask-mai-linux-arm64', platform: linux/arm64, os: ubuntu-latest },
# { name: 'ask-mai-linux-arm', platform: linux/arm, os: ubuntu-latest },
{ name: 'ask-mai-windows-amd64', platform: windows/amd64, os: windows-latest },
{ name: 'ask-mai-windows-arm64', platform: windows/arm64, os: windows-latest },
{ name: 'ask-mai-windows-386', platform: windows/386, os: windows-latest },
{ name: 'ask-mai-darwin-amd64', platform: darwin/amd64, os: macos-latest },
{ name: 'ask-mai-darwin-arm64', platform: darwin/arm64, os: macos-latest },
{ name: 'ask-mai-darwin-universal', platform: darwin/universal, os: macos-latest }
]
runs-on: ${{ matrix.build.os }}
steps:
# Setup and configure GoLang
- name: Setup GoLang
uses: actions/setup-go@v4
with:
check-latest: true
go-version: 1.23.1
# Setup and configure NodeJS
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
# install wails and dependencies
- name: Install Wails
run: |
WAILS_VERSION=$(cat go.mod | grep "^\s*github.com/wailsapp/wails/" | sed 's/^\s*//' | cut -d" " -f2)
echo "Use Wails version: ${WAILS_VERSION}"
go install github.com/wailsapp/wails/v2/cmd/wails@${WAILS_VERSION}
shell: bash
- name: Install Linux Wails deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu upx-ucl
shell: bash
# Checkout code
- name: Check out code
uses: actions/checkout@v2
# Build
- name: Build
shell: bash
# compression will warn if upx is not installed (windows/macOS) but will not break the build
run: wails build -platform ${{ matrix.build.platform }} -upx -o ${{ matrix.build.name }}
# Package MacOS
- name: Build .app zip file
if: runner.os == 'macOS'
shell: bash
run: |
APP_DIR_NAME="$(cat wails.json | jq -r '.name' ).app"
ditto -c -k ./build/bin/${APP_DIR_NAME} ./build/bin/${{ matrix.build.name }}.app.zip
- name: Building Installer
if: runner.os == 'macOS'
shell: bash
run: |
APP_DIR_NAME="$(cat wails.json | jq -r '.name' ).app"
productbuild --component ./build/bin/${APP_DIR_NAME} ./build/bin/${{ matrix.build.name }}.pkg
# Upload build assets (only for tags)
- name: Upload build artifacts
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: Wails Build ${{ matrix.build.name }}
path: |
*/bin/
*\bin\*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*/bin/*