ci: add build

This commit is contained in:
Mohamed Sohail 2022-05-05 16:29:29 +03:00
parent 2457ee7483
commit 342bb98d1b
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
5 changed files with 85 additions and 1 deletions

38
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: goreleaser
on:
push:
tags:
- "v*"
jobs:
goreleaser:
runs-on: ubuntu-latest
environment: build
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.GEDOCKER_USERNAME }}
password: ${{ secrets.GEDOCKER_PASSWORD }}
- name: Prepare Dependencies
run: |
make dist
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: --parallelism 1 --rm-dist --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.idea
.env
dev/dev-data
dist/

31
.goreleaser.yaml Normal file
View File

@ -0,0 +1,31 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
main: ./cmd
ldflags:
- -s -w
archives:
- format: tar.gz
files:
- LICENSE
- config.toml
- queries.sql
- migrations/*
dockers:
- goos: linux
goarch: amd64
ids:
- cic-dw
image_templates:
- "docker.grassecon.net/cic-dw/cic-dw:latest"
- "docker.grassecon.net/cic-dw/cic-dw:{{ .Tag }}"
dockerfile: Dockerfile
extra_files:
- config.toml
- queries.sql

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM debian:11-slim
RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /cic-dw
COPY cic-dw .
COPY config.toml .
COPY queries.sql .
CMD ["./cic-dw"]

2
go.mod
View File

@ -11,6 +11,7 @@ require (
github.com/lmittmann/w3 v0.7.0
github.com/nleof/goyesql v1.0.1
github.com/rs/zerolog v1.26.1
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba
)
require (
@ -47,7 +48,6 @@ require (
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
google.golang.org/protobuf v1.28.0 // indirect