-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ad97d0
commit caf571a
Showing
1 changed file
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/heads/') | ||
|
||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.17.1' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Linux dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y wget pkg-config libsdl2-dev | ||
- name: Install Go dependencies | ||
run: go get -v | ||
|
||
- name: Build | ||
run: go build -v | ||
|
||
- name: Update executable | ||
run: | | ||
chmod +x impregnate | ||
mv impregnate impregnate.Linux | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: impregnate-linux | ||
path: impregnate.Linux | ||
|
||
build-mac: | ||
runs-on: macos-latest | ||
if: startsWith(github.ref, 'refs/heads/') | ||
|
||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.17.1' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: brew install pkg-config sdl2 | ||
|
||
- name: Install Go dependencies | ||
run: go get -v | ||
|
||
- name: Build | ||
run: go build -v | ||
|
||
- name: Update executable | ||
run: | | ||
chmod +x impregnate | ||
mv impregnate impregnate.MacOS | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: impregnate-macos | ||
path: impregnate.MacOS | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
if: startsWith(github.ref, 'refs/heads/') | ||
|
||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.17.1' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup MSYS2 | ||
uses: msys2/setup-msys2@v2 | ||
|
||
- name: Install Windows dependencies | ||
shell: msys2 {0} | ||
run: | | ||
pacman -S --noconfirm 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 | ||
- name: Build | ||
shell: msys2 {0} | ||
run: | | ||
export GOROOT=/mingw64/lib/go | ||
export GOPATH=/mingw64 | ||
go build -v | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: impregnate-windows | ||
path: impregnate.exe | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build-linux, build-mac, build-windows] | ||
if: startsWith(github.ref, 'refs/heads/') | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: impregnate-linux | ||
path: linux | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: impregnate-macos | ||
path: macos | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: impregnate-windows | ||
path: windows | ||
|
||
- name: Create release | ||
run: | | ||
gh release delete ${{ env.VERSION }} -y | ||
gh release create ${{ env.VERSION }} -p -t "${{ env.NAME }}" -n "${{ github.event.head_commit.message }}" ${{ env.FILES }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: 'dev' | ||
NAME: 'Impregnate Dev' | ||
FILES: linux/impregnate.Linux macos/impregnate.MacOS windows/impregnate.exe |