From 9f445ffeae6fa931c805334c12040ac0a5f37b07 Mon Sep 17 00:00:00 2001 From: Hugo Renard Date: Fri, 19 Aug 2022 11:57:51 +0200 Subject: [PATCH] feat: goreleaser ci --- .gitignore | 3 ++- .gitlab-ci.yml | 25 +++++++++++++++++++++++++ .goreleaser.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++ Containerfile | 3 +++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100644 .goreleaser.yaml create mode 100644 Containerfile diff --git a/.gitignore b/.gitignore index 8fa8ec7..b7bae58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ scim.zip -config.yaml \ No newline at end of file +config.yaml +dist/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e00eeaf --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..8c2c695 --- /dev/null +++ b/.goreleaser.yaml @@ -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 diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..3cc528e --- /dev/null +++ b/Containerfile @@ -0,0 +1,3 @@ +FROM scratch +ENTRYPOINT ["/scim"] +COPY scim / \ No newline at end of file