Skip to content

Commit

Permalink
.cirrus.yml: add release tasks using GoReleaser (#19)
Browse files Browse the repository at this point in the history
* .cirrus.yml: add release tasks using GoReleaser

* .cirrus.yml: rename artifacts from binaries to goreleaser_dist

* goreleaser_artifacts is even more sound
  • Loading branch information
edigaryev authored Nov 9, 2023
1 parent 8aed412 commit 24e1871
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# cloud-init image
/tools/cloud-init/cloud-init.iso

# GoReleaser
/dist
42 changes: 42 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
description: CLI for executing Cirrus tasks locally and in any CI
section: misc
formats:
- deb
- rpm

furies:
- account: cirruslabs

0 comments on commit 24e1871

Please sign in to comment.