Skip to content

Commit

Permalink
goreleaser shell scripts & run only on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasvanEyk committed Jun 13, 2023
1 parent deacb34 commit 048a638
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: GoReleaser

on:
pull_request:
push:
tags:
- "*"

permissions:
contents: write
Expand All @@ -21,7 +22,7 @@ jobs:
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean --auto-snapshot
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

# GoReleaser output
dist/
completions/
30 changes: 29 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ before:
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
- ./scripts/generate-completions
builds:
- main: main.go
binary: changelog
Expand All @@ -30,7 +31,8 @@ archives:
format_overrides:
- goos: windows
format: zip
files: []
files:
- completions/*

checksum:
name_template: "checksums.txt"
Expand All @@ -42,6 +44,32 @@ changelog:
exclude:
- "^docs:"
- "^test:"
brews:
- install: |-
bin.install "changelog"
bash_completion.install "completions/changelog.bash" => "changelog"
zsh_completion.install "completions/changelog.zsh" => "_changelog"
fish_completion.install "completions/changelog.fish"
nfpms:
- section: utils
formats:
- apk
- deb
- rpm
- archlinux
contents:
- src: ./completions/changelog.bash
dst: /usr/share/bash-completion/completions/changelog
file_info:
mode: 0644
- src: ./completions/changelog.fish
dst: /usr/share/fish/vendor_completions.d/changelog.fish
file_info:
mode: 0644
- src: ./completions/changelog.zsh
dst: /usr/share/zsh/vendor-completions/_changelog
file_info:
mode: 0644
# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
Expand Down
10 changes: 10 additions & 0 deletions scripts/generate-completions
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e
rm -rf completions
mkdir completions
for sh in bash zsh fish; do
go run main.go completion "$sh" >"completions/changelog.$sh"
done


0 comments on commit 048a638

Please sign in to comment.