Skip to content

Merge pull request #12 from Ryex/l10n_main #90

Merge pull request #12 from Ryex/l10n_main

Merge pull request #12 from Ryex/l10n_main #90

Workflow file for this run

name: build
on: push
permissions:
packages: write
contents: write
jobs:
build:
name: "Build Dungeondraft-GoPackager (${{ matrix.target.os }}, ${{ matrix.go-version }})"
runs-on: ${{ matrix.target.host || 'ubuntu-latest' }}
env:
GO111MODULE: on
strategy:
fail-fast: false
matrix:
go-version: ["1.23.x"]
target:
- os: linux
- os: windows
ext: .exe
host: windows-latest
- os: darwin
host: macos-latest
steps:
- name: Setup Go environment
id: setup-go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Force "autocrlf"
run: git config --global core.autocrlf input
- name: Checkout code
uses: actions/checkout@v4
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/fyne-cross
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/go.sum') }}
# - name: Setup msys2
# if: ${{ runner.os == 'Windows' }}
# uses: msys2/setup-msys2@v2
# with:
# msystem: UCRT64
# install: >-
# base-devel
# mingw-w64-ucrt-x86_64-toolchain
# mingw-w64-ucrt-x86_64-libwebp
# mingw-w64-ucrt-x86_64-go
- name: Install Build Deps (Linux)
if: ${{ runner.os == 'Linux' }}
# run: sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev libwebp-dev
run: sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev
# - name: Install Build Deps (Macos)
# if: ${{ runner.os == 'macOS' }}
# run: brew install webp
- name: Install Fyne (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Install Fyne
if: ${{ runner.os != 'Windows' }}
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: install go deps (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
go mod download
- name: install go deps
if: ${{ runner.os != 'Windows' }}
run: go mod download
- name: Build gui (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
cp FyneApp.toml ./cmd/dungeondraft-packager
fyne package -src ./cmd/dungeondraft-packager --release -appID io.github.ryex.dungondraft-gopackager
- name: Build gui
if: ${{ runner.os != 'Windows' }}
run: |
cp FyneApp.toml ./cmd/dungeondraft-packager
fyne package -src ./cmd/dungeondraft-packager --release -appID io.github.ryex.dungondraft-gopackager
- name: Build cli (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
go build -ldflags "-s -w" ./cmd/dungeondraft-packager-cli
- name: Build cli
if: ${{ runner.os != 'Windows' }}
run: |
go build -ldflags "-s -w" ./cmd/dungeondraft-packager-cli
- name: List dir
run: |
ls .
ls ./cmd/dungeondraft-packager
- name: Prep artifacts (windows)
if: ${{ runner.os == 'windows' }}
# shell: msys2 {0}
run: |
mkdir install
cp "./cmd/dungeondraft-packager/Dungeondraft GoPackager.exe" ./install
cp "./dungeondraft-packager-cli.exe" ./install
cp *.md ./install
# cp /ucrt64/bin/libwebp-*.dll ./install
# cp /ucrt64/bin/libsharpyuv-*.dll ./install
ls -r ./install
# ldd "./install/Dungeondraft GoPackager.exe"
# dumpbin /dependents "./install/Dungeondraft GoPackager.exe"
- name: Prep artifacts (linux)
if: ${{ runner.os == 'Linux' }}
run: |
mkdir install
tar -xJf "./Dungeondraft GoPackager.tar.xz" -C ./install
cp ./dungeondraft-packager* ./install/usr/local/bin
sed -i "/install:/install:\n\tinstall -Dm00644 usr/local/bin/$$(Exec)-cli $$(DESTDIR)$$(PREFIX)/bin/$$(Exec)-cli" ./install/Makefile
cp *.md ./install
ls -r ./install
ldd ./install/usr/local/bin/dungeondraft-packager
- name: Prep artifacts (maOS)
if: ${{ runner.os == 'macOS' }}
run: |
mkdir install
cp -r "./Dungeondraft GoPackager.app" ./install
cp ./dungeondraft-packager* ./install
cp *.md ./install
mkdir "./install/Dungeondraft GoPackager.app/Contents/Frameworks"
# cp /opt/homebrew/opt/webp/lib/libwebp.7.dylib "./install/Dungeondraft GoPackager.app/Contents/Frameworks"
# install_name_tool -change /opt/homebrew/opt/webp/lib/libwebp.7.dylib "@executable_path/../Frameworks/libwebp.7.dylib" "./install/Dungeondraft GoPackager.app/Contents/MacOS/dungeondraft-packager"
ls ./install
ls -r "./install/Dungeondraft GoPackager.app"
otool -L "./install/Dungeondraft GoPackager.app/Contents/MacOS/dungeondraft-packager"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Dungeondraft-GoPackager-${{ runner.os }}
path: install/**
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: List dir
run: ls
- name: Package
run: |
pushd Dungeondraft-GoPackager-Linux ; tar -czf ../Dungeondraft-GoPackager-Linux.tgz * ; popd
pushd Dungeondraft-GoPackager-macOS ; zip -r ../Dungeondraft-GoPackager-macOS.zip * ; popd
pushd Dungeondraft-GoPackager-Windows ; zip -r ../Dungeondraft-GoPackager-Windows.zip * ; popd
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: Dungeondraft-GoPackager-Linux/CHANGELOG.md
draft: true
files: |
Dungeondraft-GoPackager-Linux.tar.gz
Dungeondraft-GoPackager-macOS.zip
Dungeondraft-GoPackager-Windows.zip