From 36d0d536de94a9b48c90682a11017747013ce554 Mon Sep 17 00:00:00 2001 From: Daniel Krol Date: Fri, 19 Aug 2022 16:52:50 -0400 Subject: [PATCH] Github Actions and Goreleaser --- .github/workflows/build-test-release.yml | 35 ++++++++++++++++++++++++ .gitignore | 2 ++ .goreleaser.yaml | 33 ++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 .github/workflows/build-test-release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml new file mode 100644 index 0000000..2371e0b --- /dev/null +++ b/.github/workflows/build-test-release.yml @@ -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 diff --git a/.gitignore b/.gitignore index e251199..4db7308 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /sql.db + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..a0d15dd --- /dev/null +++ b/.goreleaser.yaml @@ -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:'