goreleaser

This commit is contained in:
Robert Janetzko 2022-05-10 17:47:51 +00:00
parent 2a02b4606d
commit 202ff3df6d
4 changed files with 51 additions and 24 deletions

View File

@ -21,4 +21,5 @@ USER vscode
# RUN npm install -g @angular/CLI # RUN npm install -g @angular/CLI
# [Optional] Uncomment this line to install global node packages. # [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
RUN go install github.com/tc-hib/go-winres@latest RUN go install github.com/tc-hib/go-winres@latest \
&& go install github.com/goreleaser/goreleaser@latest

View File

@ -3,8 +3,10 @@ name: Build LegendsBrowser
on: on:
push: push:
branches: [ master ] branches: [ master ]
tags: [ '**' ]
pull_request: pull_request:
branches: [ master ] branches: [ master ]
workflow_dispatch:
jobs: jobs:
@ -18,26 +20,26 @@ jobs:
with: with:
go-version: 1.18 go-version: 1.18
- name: Build MacOS - name: Build
run: cd backend && GOOS=darwin GOARCH=amd64 go build -o ../bin/legendsbrowser-mac-intel run: cd backend && go build -v ./...
- name: Build Linux
run: cd backend && GOOS=linux GOARCH=amd64 go build -o ../bin/legendsbrowser-linux-x64
- name: Build Windows
run: cd backend && GOOS=windows GOARCH=amd64 go build -o ../bin/legendsbrowser-win-x64.exe
- name: Upload MacOS Artifact release:
uses: actions/upload-artifact@v3 runs-on: ubuntu-latest
with: needs: [ build ]
name: mac-os if: ${{ startsWith(github.ref, 'refs/tags/') }}
path: bin/legendsbrowser-mac-intel steps:
- name: Upload Linux Artifact - uses: actions/checkout@v2
uses: actions/upload-artifact@v3
with:
name: linux
path: bin/legendsbrowser-linux-x64
- name: Upload MacOS Artifact
uses: actions/upload-artifact@v3
with:
name: windows
path: bin/legendsbrowser-win-x64.exe
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
workdir: backend
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
backend/.gitignore vendored
View File

@ -3,3 +3,4 @@ same.json
conf.json conf.json
_conf.json _conf.json
/*.png /*.png
dist/

23
backend/.goreleaser.yaml Normal file
View File

@ -0,0 +1,23 @@
builds:
- binary: legendsbrowser
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
archives:
- format: zip
name_template: "legendsbrowser-{{ .Version }}-{{ .Os }}"
replacements:
darwin: macos
linux: linux
windows: win
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'