From 19d8c695b28ad1c1ec92dd043c0d0e3bd12badca Mon Sep 17 00:00:00 2001 From: zaba505 Date: Wed, 12 Oct 2022 21:47:21 -0400 Subject: [PATCH] build(evrys): add dockerfile and goreleaser --- .github/workflows/main.yml | 16 +++++++++++++++- .gitignore | 5 ++++- .goreleaser.yaml | 32 ++++++++++++++++++++++++++++++++ Dockerfile | 19 +++++++++++++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 .goreleaser.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16bd7f5..5da793a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,11 +3,16 @@ name: main on: push: branches: [ "main" ] + tags: + - '*' pull_request: branches: [ "main" ] -jobs: +permissions: + contents: write + packages: write +jobs: build: runs-on: ubuntu-latest steps: @@ -23,3 +28,12 @@ jobs: - name: Test run: go test -v -race -cover ./... + + - uses: goreleaser/goreleaser-action@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index cfa5c46..549a6ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Goreleaser +dist/ + # Terraform # Local .terraform directories **/.terraform/* @@ -36,4 +39,4 @@ terraform.rc # Editors .vscode -.idea \ No newline at end of file +.idea diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..e610157 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,32 @@ +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +dockers: + - image_templates: + - "ghcr.io/z5labs/evrys/evrys:{{ .Tag }}" + - "ghcr.io/z5labs/evrys/evrys:latest" +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:' + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f6486a6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Copyright 2022 Z5Labs and Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM golang:1.19 + +ADD evrys . + +ENTRYPOINT [ "./evrys" ] \ No newline at end of file