Skip to content

Commit

Permalink
feat: make release script portable
Browse files Browse the repository at this point in the history
Ensures the hack/release.sh script is more portable by using the
/usr/bin/env shebang.

Signed-off-by: Tim Jones <[email protected]>
  • Loading branch information
TimJones committed Aug 28, 2024
1 parent 7048c24 commit 295eb33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions hack/release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-27T16:16:08Z by kres 8e4bbb4-dirty.
# Generated on 2024-08-28T15:19:26Z by kres 0b55936-dirty.

set -e

Expand Down
5 changes: 5 additions & 0 deletions internal/output/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ func splitIgnoringPreamble(r io.Reader) ([]string, error) {
contents = append(contents, line)
}

// `#!` is a shebang and not preamble
if strings.HasPrefix(line, "#!") {
contents = append(contents, line)
}

if inPreamble && (stringContainsPreamble(line, comments...) || line == "" || line == "---") {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion internal/output/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (o *Output) Permissions(filename string) os.FileMode {
}

func (o *Output) releaseScript(w io.Writer) error {
if _, err := w.Write([]byte("#!/bin/bash\n\n")); err != nil {
if _, err := w.Write([]byte("#!/usr/bin/env bash\n\n")); err != nil {
return err
}

Expand Down

0 comments on commit 295eb33

Please sign in to comment.