Github Actions and Goreleaser

This commit is contained in:
Daniel Krol 2022-08-19 16:52:50 -04:00
parent aa691dbc09
commit 36d0d536de
3 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,35 @@
name: Go package
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Test
run: go test -v ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wallet-sync-server-${{ github.sha }}
path: |
dist/checksums.txt
dist/*.tar.gz

2
.gitignore vendored
View file

@ -1 +1,3 @@
/sql.db
dist/

33
.goreleaser.yaml Normal file
View file

@ -0,0 +1,33 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
project_name: wallet-sync-server
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=1 # for sqlite3 library
goos: # haven't figured out windows and darwin given cgo/sqlite3
- linux
goarch:
- amd64 # Necessary for cgo/sqlite3
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'