Skip to content

Commit

Permalink
dont hardcode project name in build-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rainu committed Dec 12, 2024
1 parent db799d2 commit 981e69a
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Wails build

on:
push:
tags:
# Match any new tag
- '*'
# 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
Expand Down Expand Up @@ -40,6 +38,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20

# install wails
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.9.0
Expand All @@ -48,41 +47,35 @@ jobs:
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
- name: Install macOS Wails deps
if: runner.os == 'macOS'
run: brew install mitchellh/gon/gon
shell: bash
- name: Check out code into the Go module directory

# Checkout code
- name: Check out code
uses: actions/checkout@v2

# Build
- name: Build
id: binary_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 }}

# Add permissions
- name: Add macOS perms
if: runner.os == 'macOS'
run: chmod +x build/bin/*/Contents/MacOS/*
shell: bash
- name: Add Linux perms
if: runner.os == 'Linux'
run: chmod +x build/bin/*
shell: bash

# Package MacOS
- name: Build .app zip file
if: runner.os == 'macOS'
shell: bash
run: |
ditto -c -k ./build/bin/ask-mai.app ./build/bin/${{ matrix.build.name }}.app.zip
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: |
productbuild --component ./build/bin/ask-mai.app ./build/bin/${{ matrix.build.name }}.pkg
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
- uses: actions/upload-artifact@v3
# 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: |
Expand Down

0 comments on commit 981e69a

Please sign in to comment.