diff --git a/.cirrus.yml b/.cirrus.yml index 5a1962a..00e3db8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,3 +5,33 @@ task: name: Test script: go test -v ./... + +task: + name: Release (Dry Run) + only_if: $CIRRUS_TAG == '' + depends_on: + - Lint + - Test + install_script: + - echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list + - apt-get update + - apt-get -y install goreleaser-pro + release_script: goreleaser build --snapshot + goreleaser_artifacts: + path: "dist/**" + +task: + name: Release + only_if: $CIRRUS_TAG != '' + depends_on: + - Lint + - Test + env: + GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!] + FURY_TOKEN: ENCRYPTED[!97fe4497d9aca60a3d64904883b81e21f19706c6aedda625c97f62f67ec46b8efa74c55699956158bbf0a23726e7d9f6!] + GORELEASER_KEY: ENCRYPTED[!9b80b6ef684ceaf40edd4c7af93014ee156c8aba7e6e5795f41c482729887b5c31f36b651491d790f1f668670888d9fd!] + install_script: + - echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list + - apt-get update + - apt-get -y install goreleaser-pro + release_script: goreleaser diff --git a/.gitignore b/.gitignore index f8bd039..35b7006 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ # cloud-init image /tools/cloud-init/cloud-init.iso + +# GoReleaser +/dist diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..57af867 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,42 @@ +project_name: vetu + +before: + hooks: + - go mod download + +builds: + - main: cmd/vetu/main.go + ldflags: > + -X github.com/cirruslabs/vetu/internal/version.Version={{.Version}} + -X github.com/cirruslabs/vetu/internal/version.Commit={{.ShortCommit}} + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + +archives: + - id: binary + format: binary + name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" + - id: regular + name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" + +release: + prerelease: auto + +nfpms: + - package_name: vetu + vendor: Cirrus Labs, Inc. + homepage: https://github.com/cirruslabs/vetu + maintainer: support@cirruslabs.org + description: CLI for executing Cirrus tasks locally and in any CI + section: misc + formats: + - deb + - rpm + +furies: + - account: cirruslabs