Skip to content

Commit

Permalink
Try build with cross-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascdev committed May 17, 2024
1 parent 7541653 commit e92fc18
Showing 1 changed file with 23 additions and 35 deletions.
58 changes: 23 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:

build-linux:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -21,53 +21,41 @@ jobs:
with:
go-version: '1.22'

- name: Build
run: go build -v -ldflags "-s -w" -o hasherino-linux
- name Install dependencies
run: |
sudo apt-get update
sudo apt-get gcc libgl1-mesa-dev xorg-dev gcc-mingw-w64
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: hasherino-linux
path: hasherino-linux

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Linux build
run: go build -v -ldflags "-s -w" -o hasherino-linux

- name: Build
run: go build -v -ldflags "-s -w" -o hasherino-windows.exe
- name: Windows build
run: |
export GOOS=windows
export GOARCH=amd64
export CGO_ENABLED=1
export CC=x86_64-w64-mingw32-gcc
go build -v -ldflags "-s -w" -o hasherino-windows.exe
- name: Upload artifact
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: hasherino-windows
path: hasherino-windows.exe

name: hasherino
path: |
hasherino-linux
hasherino-windows.exe
release:
runs-on: ubuntu-latest
needs: [build-linux, build-windows]
needs: build

steps:
- uses: actions/checkout@v3

- name: Download windows artifact
id: linux
uses: actions/download-artifact@v3
with:
name: 'hasherino-windows'
path: 'artifacts'

- name: Download linux artifact
id: windows
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: 'hasherino-linux'
name: 'hasherino'
path: 'artifacts'

- name: Release
Expand Down

0 comments on commit e92fc18

Please sign in to comment.