feat: goreleaser ci

This commit is contained in:
Hugo Renard 2022-08-19 11:57:51 +02:00
parent d6ba5b515b
commit 9f445ffeae
Signed by: hougo
GPG key ID: 3A285FD470209C59
4 changed files with 72 additions and 1 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
scim.zip scim.zip
config.yaml config.yaml
dist/

25
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,25 @@
stages:
- release
release:
stage: release
image: docker:stable
services:
- docker:dind
variables:
GIT_DEPTH: 0
WORKDIR: /go/src/lab.libreho.st/libre.sh/scim/scim
only:
refs:
- tags
script: |
docker run --rm --privileged \
-v $PWD:$WORKDIR \
-w $WORKDIR \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_USERNAME -e DOCKER_PASSWORD \
-e CI_JOB_TOKEN \
goreleaser/goreleaser release --rm-dist

42
.goreleaser.yaml Normal file
View file

@ -0,0 +1,42 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
targets:
- linux_amd64_v1
- linux_arm64
- linux_386
dockers:
- image_templates:
- "libresh/scim:{{.Tag}}"
- "libresh/scim:latest"
build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
dockerfile: Containerfile
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:"
gitlab_urls:
api: https://lab.libreho.st/api/v4/
download: https://lab.libreho.st/
use_package_registry: true
use_job_token: true

3
Containerfile Normal file
View file

@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/scim"]
COPY scim /