ci: use goreleaser orb

main
sundowndev 2021-07-09 13:22:32 +02:00
parent 1a470d1b27
commit e1fed82753
2 changed files with 8 additions and 54 deletions

View File

@ -1,6 +1,7 @@
version: 2.1 version: 2.1
orbs: orbs:
go: circleci/go@1.5.0 go: circleci/go@1.5.0
goreleaser: hubci/goreleaser@1.0.0
jobs: jobs:
build: build:
docker: docker:
@ -83,46 +84,6 @@ jobs:
./codecov ./codecov
- store_test_results: - store_test_results:
path: ./ path: ./
sign_release:
docker:
- image: cimg/base:2020.01
steps:
- attach_workspace:
at: ~/project
- run:
name: "Ensure GnuPG is available"
command: gpg --version
- run:
name: "Import cloudskiff signing key"
command: |
echo ${SIGNINGKEY} | base64 -d > signingkey
gpg --import signingkey
- run:
name: "Sign release"
command: |
gpg --output bin/driftctl_SHA256SUMS.gpg -u security@cloudskiff.com --detach-sig bin/driftctl_SHA256SUMS
- run:
name: "Verify signature"
command: |
gpg --verify bin/driftctl_SHA256SUMS.gpg bin/driftctl_SHA256SUMS
- persist_to_workspace:
root: ~/project
paths:
- bin/
release:
environment:
CIRCLE_PROJECT_USERNAME: cloudskiff
CIRCLE_PROJECT_REPONAME: driftctl
docker:
- image: cibuilds/github:0.13
steps:
- attach_workspace:
at: ~/project
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(./bin/driftctl_linux_amd64 version)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n ${VERSION} ${VERSION} ./bin/
publish-aur: publish-aur:
environment: environment:
AUR_GIT: ssh://aur@aur.archlinux.org/driftctl-bin.git AUR_GIT: ssh://aur@aur.archlinux.org/driftctl-bin.git
@ -243,21 +204,13 @@ workflows:
only: /^v.*/ only: /^v.*/
branches: branches:
ignore: /.*/ ignore: /.*/
- sign_release: - goreleaser/release:
context: cloudskiff-signing version: 0.173.2
requires: go-version: 1.16.5
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- release:
context: driftctl context: driftctl
requires: requires:
- lint - lint
- test - test
- sign_release
filters: filters:
tags: tags:
only: /^v.*/ only: /^v.*/
@ -265,7 +218,7 @@ workflows:
ignore: /.*/ ignore: /.*/
- publish-aur: - publish-aur:
requires: requires:
- release - goreleaser/release
filters: filters:
tags: tags:
only: /^v.*/ only: /^v.*/
@ -274,7 +227,7 @@ workflows:
- update-lambda: - update-lambda:
context: driftctl-version-lambda context: driftctl-version-lambda
requires: requires:
- release - goreleaser/release
filters: filters:
tags: tags:
only: /^v.*/ only: /^v.*/

View File

@ -12,7 +12,7 @@ before:
signs: signs:
- signature: "${artifact}.gpg" - signature: "${artifact}.gpg"
artifacts: checksum artifacts: checksum
args: [ "--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}" ] args: [ "--batch", "-u", "{{ .Env.SIGNINGKEY }}", "--output", "${signature}", "--detach-sign", "${artifact}" ]
builds: builds:
- id: "driftctl-build" - id: "driftctl-build"
binary: driftctl binary: driftctl
@ -45,6 +45,7 @@ dockers:
- "cloudskiff/driftctl:latest" - "cloudskiff/driftctl:latest"
- "cloudskiff/driftctl:{{ .Tag }}" - "cloudskiff/driftctl:{{ .Tag }}"
dockerfile: Dockerfile_release dockerfile: Dockerfile_release
skip_push: true
build_flag_templates: build_flag_templates:
- --label=org.opencontainers.image.title={{ .ProjectName }} - --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }} - --label=org.opencontainers.image.description={{ .ProjectName }}