Skip to content

Asar Stuff

Asar Stuff #9

Workflow file for this run

# Based partially on Alyxia's work, thanks so much!
name: Release
on:
push:
tags:
- v*
env:
FORCE_COLOR: true
jobs:
build-linux:
runs-on: ubuntu-20.04 # hopefully older glibc for better compatibility on systems like debian bullseye
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Go dependencies
run: go get -v
- name: Build Cli
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -tags "static cli" -ldflags "-s -w -X 'equilotl/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'equilotl/buildinfo.InstallerTag=${{ github.ref_name }}'" -o EquilotlCli-linux
- name: Update executable
run: |
chmod +x EquilotlCli-linux
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Equilotl-linux
path: |
EquilotlCli-linux
build-mac:
runs-on: macos-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- id: go-cache-paths
run: |
echo "go_build=$(go env GOCACHE)" >> $GITHUB_ENV
echo "go_mod=$(go env GOMODCACHE)" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: brew install pkg-config sdl2
- name: Install Go dependencies
run: go get -v
- name: Build
run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -tags static -ldflags "-s -w -X 'equilotl/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'equilotl/buildinfo.InstallerTag=${{ github.ref_name }}'" -o Equilotl
- name: Update executable
run: |
chmod +x Equilotl
- name: Generate MacOS bundle
run: |
mkdir -p Equilotl.app/Contents/MacOS
mkdir -p Equilotl.app/Contents/Resources
cp macos/Info.plist Equilotl.app/Contents/Info.plist
mv Equilotl Equilotl.app/Contents/MacOS/Equilotl
cp macos/icon.icns Equilotl.app/Contents/Resources/icon.icns
zip -r Equilotl.MacOS.zip Equilotl.app
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Equilotl-macos
path: Equilotl.MacOS.zip
build-windows:
runs-on: windows-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
- name: Install Windows dependencies
shell: msys2 {0}
run: |
pacman -S --noconfirm git mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
- name: Install Go dependencies
shell: msys2 {0}
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
go get -v
go install github.com/tc-hib/go-winres@latest
- name: Build Gui
shell: msys2 {0}
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
go-winres make --product-version "git-tag"
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w -H=windowsgui -extldflags=-static -X 'equilotl/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'equilotl/buildinfo.InstallerTag=${{ github.ref_name }}'" -o Equilotl.exe
- name: Build i386 Cli
shell: msys2 {0}
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -v -tags "static cli" -ldflags "-s -w -extldflags=-static -X 'equilotl/buildinfo.InstallerGitHash=$(git rev-parse --short HEAD)' -X 'equilotl/buildinfo.InstallerTag=${{ github.ref_name }}'" -o EquilotlCli.exe
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Equilotl-windows
path: |
Equilotl.exe
EquilotlCli.exe
release:
runs-on: ubuntu-latest
needs: [build-linux, build-mac, build-windows]
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Equilotl-linux
path: linux
- uses: actions/download-artifact@v3
with:
name: Equilotl-macos
path: macos
- uses: actions/download-artifact@v3
with:
name: Equilotl-windows
path: windows
- name: Create the release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v1
env:
GITHUB_TOKEN: ${{ secrets.ETOKEN }}
with:
name: ${{ github.ref_name }}
prerelease: false
draft: false
files: |
linux/EquilotlCli-linux
macos/Equilotl.MacOS.zip
windows/Equilotl*.exe