diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 16eb98f..4a418ef 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,6 +15,7 @@ "ghcr.io/devcontainers/features/docker-in-docker": {}, "ghcr.io/dhoeric/features/act": {}, }, + "postCreateCommand": ".devcontainer/post-create.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 0000000..6b9717a --- /dev/null +++ b/.devcontainer/post-create.sh @@ -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://raw.githubusercontent.com/anchore/syft/main/install.sh | sudo sh -s -- -b /usr/local/bin diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8f49795 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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://raw.githubusercontent.com/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 }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ee0dba --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Ignore goreleaser output +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..0cd4236 --- /dev/null +++ b/.goreleaser.yaml @@ -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