Skip to content

Commit e9ed7b8

Browse files
committed
Start on packaging
1 parent 3e120c3 commit e9ed7b8

3 files changed

Lines changed: 102 additions & 27 deletions

File tree

.goreleaser.yaml

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ project_name: fftools
44

55
before:
66
hooks:
7-
# You may remove this if you don't use go modules.
87
- go mod tidy
9-
# you may remove this if you don't need go generate
10-
- go generate ./...
8+
- ./bin/gen_manpages.sh
119

1210
builds:
1311
- id: asciify
@@ -79,6 +77,13 @@ builds:
7977
- linux
8078
- windows
8179
- darwin
80+
ldflags:
81+
- -s
82+
- -w
83+
- -X github.com/FileFormatInfo/fftools/internal.VERSION={{.Version}}
84+
- -X github.com/FileFormatInfo/fftools/internal.LASTMOD={{.Timestamp}}
85+
- -X github.com/FileFormatInfo/fftools/internal.COMMIT={{.ShortCommit}}
86+
- -X github.com/FileFormatInfo/fftools/internal.BUILDER=goreleaser
8287

8388
archives:
8489
- formats: [tar.gz]
@@ -94,26 +99,38 @@ archives:
9499
format_overrides:
95100
- goos: windows
96101
formats: [zip]
97-
ids:
102+
#- files:
103+
# - LICENSE.txt
104+
# - manpages/*
105+
106+
homebrew_casks:
107+
- name: fftools
108+
binaries:
98109
- asciify
99110
- asciitable
100111
- bytecount
101112
- certinfo
102113
- hexdumpc
103114
- unicount
104115
- uniwhat
116+
# manpages:
117+
# completions:
118+
directory: pkg/cask
119+
skip_upload: true
120+
commit_author:
121+
name: Andrew Marcuse
122+
email: fileformat@gmail.com
123+
description: "Utilities for analyzing, viewing and fixing file formats."
124+
homepage: "https://tools.fileformat.info/"
125+
license: "GPL-3.0-or-later"
126+
repository:
127+
owner: FileFormatInfo
128+
name: fftools-tap
129+
# token:
105130

106131
nfpms:
107132
- id: fftools
108133
package_name: fftools
109-
ids:
110-
- asciify
111-
- asciitable
112-
- bytecount
113-
- certinfo
114-
- hexdumpc
115-
- unicount
116-
- uniwhat
117134
vendor: FileFormatInfo
118135
homepage: "https://www.fileformat.info/"
119136
maintainer: Andrew Marcuse <fileformat@gmail.com>
@@ -123,31 +140,36 @@ nfpms:
123140
formats:
124141
- deb
125142
- rpm
143+
# - contents:
144+
# - src: ./manpages/
145+
# dst: /usr/share/man/man1/
146+
# type: dir
147+
# file_info:
148+
# mode: 0644
126149

127-
release:
128-
github:
129-
owner: FileFormatInfo
130-
name: fftools
131150

132151
report_sizes: true
133152

134-
source:
135-
enabled: true
136-
name_template: "{{ .ProjectName }}.src"
153+
#source:
154+
# enabled: true
155+
# name_template: "{{ .ProjectName }}.src"
137156

138-
upx:
139-
- enabled: true
157+
#upx:
158+
# - enabled: true
140159

141-
changelog:
142-
sort: asc
143-
filters:
144-
exclude:
145-
- "^docs:"
146-
- "^test:"
160+
#changelog:
161+
# sort: asc
162+
# filters:
163+
# exclude:
164+
# - "^docs:"
165+
# - "^test:"
147166

148167
release:
149168
footer: >-
150169
151170
---
152171
153172
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
173+
# github:
174+
# owner: FileFormatInfo
175+
# name: fftools

bin/gen_manpages.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
#
3+
# build binaries
4+
#
5+
6+
set -o errexit
7+
set -o pipefail
8+
set -o nounset
9+
10+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11+
REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
12+
13+
MANPAGE_DIR="${REPO_DIR}/manpages"
14+
15+
echo "INFO: starting at $(date -u +%Y-%m-%dT%H:%M:%SZ)"
16+
17+
if [ ! -d "${MANPAGE_DIR}" ]; then
18+
echo "INFO: creating manpage directory ${MANPAGE_DIR}"
19+
mkdir "${MANPAGE_DIR}"
20+
else
21+
echo "INFO: using existing manpage directory ${MANPAGE_DIR}"
22+
fi
23+
24+
FILES=$(ls "${REPO_DIR}/cmd")
25+
26+
for f in $FILES; do
27+
if [ -f "${MANPAGE_DIR}/${f}" ]; then
28+
echo "WARNING: file ${MANPAGE_DIR}/${f} already exists"
29+
continue
30+
fi
31+
echo "INFO: compiling ${f}"
32+
#LATER: go build -o "${MANPAGE_DIR}/${f}" "${REPO_DIR}/cmd/${f}"
33+
done
34+
35+
echo "INFO: complete at $(date -u +%Y-%m-%dT%H:%M:%SZ)"

bin/localrelease.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# build binaries with GoReleaser
4+
#
5+
6+
set -o errexit
7+
set -o pipefail
8+
set -o nounset
9+
10+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11+
REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
12+
13+
echo "INFO: starting at $(date -u +%Y-%m-%dT%H:%M:%SZ)"
14+
15+
cd "${REPO_DIR}"
16+
goreleaser --snapshot --clean release
17+
18+
echo "INFO: complete at $(date -u +%Y-%m-%dT%H:%M:%SZ)"

0 commit comments

Comments
 (0)