Skip to content

Commit

Permalink
add release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
doorbash committed Nov 30, 2021
1 parent fc1bd3a commit 51d401b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/goreleaser.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: release

on:
release:
types: [published]

jobs:
generate:
name: Generate cross-platform builds
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Print go tool dist list
run: go tool dist list

- name: Build
run: |
platforms=("linux/amd64" "darwin/amd64" "windows/amd64")
for x in "${platforms[@]}"; do
os=${x%%/*}
arch=${x##*/}
filename=${{ github.event.repository.name }}-$os-$arch
if [ "$os" == "windows" ]; then
filename+=".exe"
fi
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o dist/$filename -trimpath -ldflags "-s -w"
done
- name: Upload build-artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: "./dist/*"

0 comments on commit 51d401b

Please sign in to comment.