Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
feat: release yot homebrew, snap, and linux packages (#78)
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Davis <[email protected]>
  • Loading branch information
Jeff Davis committed Jun 3, 2021
1 parent 46f5ca1 commit 998feb4
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 11 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Set up Snapcraft
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
-
name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -28,6 +36,11 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Snapcraft Login
if: startsWith(github.ref, 'refs/tags/v')
run: |
snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}")
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand All @@ -36,3 +49,4 @@ jobs:
args: release --rm-dist -f ./.goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.GH_PAT }}
112 changes: 101 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
- ./scripts/completions.sh
builds:
- env:
- id: yot
env:
- CGO_ENABLED=0
goos:
- linux
Expand All @@ -26,6 +23,13 @@ archives:
386: i386
amd64: x86_64
name_template: "yot_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format_overrides:
- goos: windows
format: zip
files:
- README.md
- LICENSE
- completions/*
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -34,11 +38,11 @@ changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- '^chore:'
- '^build'
- '^docs(\(.*\))?:'
- '^test(\(.*\))?:'
- '^ci(\(.*\))?:'
- '^chore(\(.*\))?:'
- '^build(\(.*\))?:'
project_name: yot
dockers:
- image_templates:
Expand All @@ -55,3 +59,89 @@ dockers:
- "--label=org.opencontainers.image.licenses=MIT"
- "--label=VERSION={{.Version}}"
- "--platform=linux/amd64"
brews:
- name: yot

tap:
owner: vmware-tanzu-labs
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"

# Git author used to commit to the repository.
# Defaults are shown.
commit_author:
name: goreleaserbot
email: [email protected]

# Folder inside the repository to put the formula.
# Default is the root folder.
folder: Formula

# Your app's homepage.
# Default is empty.
homepage: "https://github.com/vmware-tanzu-labs/yaml-overlay-tool"

# Template of your app's description.
# Default is empty.
description: "A YAML Overlay Tool with templating tendencies."

# SPDX identifier of your app's license.
# Default is empty.
license: "MIT"

# Setting this will prevent goreleaser to actually try to commit the updated
# formula - instead, the formula file will be stored on the dist folder only,
# leaving the responsibility of publishing it to the user.
# If set to auto, the release will not be uploaded to the homebrew tap
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
# Default is false.
skip_upload: auto

# Packages your package depends on.
dependencies:
- name: kubectl
type: optional

install: |-
bin.install "yot"
bash_completion.install "completions/yot.bash" => "yot"
zsh_completion.install "completions/yot.zsh" => "_yot"
fish_completion.install "completions/yot.fish"
# So you can `brew test` your formula.
# Default is empty.
test: |
system "#{bin}/yot --version"
nfpms:
- file_name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
homepage: https://github.com/vmware-tanzu-labs/yaml-overlay-tool.com
description: "A YAML Overlay Tool with templating tendencies."
maintainer: Jeff Davis <[email protected]>, Andrew Huffman <[email protected]>
license: MIT
vendor: VMware Tanzu Labs
contents:
- src: ./completions/yot.bash
dst: /etc/bash_completion.d/yot
- src: ./completions/yot.fish
dst: /usr/share/fish/completions/yot.fish
- src: ./completions/yot.zsh
dst: /usr/local/share/zsh/site-functions/_yot
formats:
- apk
- deb
- rpm
recommends:
- kubectl
snapcrafts:
- name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
name: yaml-overlay-tool
summary: "A YAML Overlay Tool with templating tendencies."
description: |
YAML Overlay Tool, or Yot for short, often pronounced /yaucht/, is a tool
to assist with patching YAML files. Yot uses JSONPath to query YAML documents
within YAML files, and to perform a change. YAML Overlay Tool operates on YAML
nodes. It is able to preserve and inject head, foot, and line comments into the
new output versions of the files that you manipulate.
grade: stable
confinement: strict
publish: true
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/vmware-tanzu-labs/yaml-overlay-tool)](https://goreportcard.com/report/github.com/vmware-tanzu-labs/yaml-overlay-tool)
[![GitHub](https://img.shields.io/github/license/vmware-tanzu-labs/yaml-overlay-tool)](https://github.com/vmware-tanzu-labs/yaml-overlay-tool/blob/main/LICENSE)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/vmware-tanzu-labs/yaml-overlay-tool)](https://github.com/vmware-tanzu-labs/yaml-overlay-tool/releases)
![Github Downloads (by Release)](https://img.shields.io/github/downloads/vmware-tanzu-labs/yaml-overlay-tool/total.svg)

[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/yaml-overlay-tool)
# YAML Overlay Tool (Yot)

YAML Overlay Tool, or Yot for short, often pronounced */yaucht/*, is a tool to assist with patching YAML files. Yot uses JSONPath to query YAML documents within YAML files, and to perform a change. YAML Overlay Tool operates on YAML nodes. It is able to preserve and inject head, foot, and line comments into the new output versions of the files that you manipulate.
Expand Down
7 changes: 7 additions & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
rm -rf completions
mkdir completions
for sh in bash zsh fish; do
go run ./cmd/yot completion "$sh" >"completions/yot.$sh"
done

0 comments on commit 998feb4

Please sign in to comment.