Repos / shark / 17678d2744
commit 17678d27444258c612dd36b67525babb7fd1cc59
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Fri Jul 1 22:54:06 2022 +0700
upload artifact to gh release
diff --git a/.builds/debian.yml b/.builds/debian.yml
index 18131e6..b81aa09 100644
--- a/.builds/debian.yml
+++ b/.builds/debian.yml
@@ -23,8 +23,8 @@ tasks:
export PATH="$PATH:/usr/lib/go-1.18/bin"
go version
make linux
- make win
+ make windows
artifacts:
- shark/dist/shark-linux
- - shark/dist/shark-win.exe
+ - shark/dist/shark-windows.exe
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 115ac8e..b192f4f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,10 +1,7 @@
name: win+mac+linux
on:
- push:
- branches: [ "master" ]
- pull_request:
- branches: [ "master" ]
+ push
jobs:
@@ -26,7 +23,9 @@ jobs:
if: runner.os == 'Linux'
run: make deps-debian
- - run: make
+ - name: Build for ${{ runner.os }}
+ run: make $(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]')
+ # The `tr` stuff is to convert the string to lowercase
- name: Upload ${{ runner.os }} build
uses: actions/upload-artifact@v3
@@ -36,7 +35,7 @@ jobs:
- name: Cross-compile Windows build
if: runner.os == 'Linux'
- run: make win
+ run: make windows
- name: Upload cross-compiled Windows build
if: runner.os == 'Linux'
@@ -44,3 +43,17 @@ jobs:
with:
name: Windows shark
path: dist/*.exe
+
+ - name: Upload artifacts to tagged release
+ if: github.ref_type == 'tag'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TAG: ${{ github.ref_name }}
+ run: |
+ # Because we have multiple OSes in the build matrix, we need to either
+ # create a new release, or upload to the release if it already exists.
+ if gh release view "$TAG"; then
+ gh release upload "$TAG" dist/*
+ else
+ gh release create "$TAG" dist/* --generate-notes
+ fi
diff --git a/Makefile b/Makefile
index 360f23e..ddeb7ee 100644
--- a/Makefile
+++ b/Makefile
@@ -2,16 +2,16 @@
# Details here: https://github.com/hajimehoshi/ebiten/issues/1367
build:
- go build -tags ebitensinglethread -o dist/shark
+ go build -tags ebitensinglethread -o dist/
linux:
GOOS=linux GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-linux
-win:
- GOOS=windows GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-win.exe
+windows:
+ GOOS=windows GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-windows.exe
-mac:
- GOOS=darwin GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-mac
+macos:
+ GOOS=darwin GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-macos
clean:
rm -f dist/*