Skip to content

Commit

Permalink
goreleaser on Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
Miha Kralj committed Sep 15, 2023
1 parent bf9f30f commit 8bd73bb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 13 deletions.
40 changes: 40 additions & 0 deletions .github/make_manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

GOARCH=amd64
GOOS=freebsd
mkdir -p ./dist/pkg/usr/local/bin
go build -ldflags="-w" -o ./dist/pkg/usr/local/bin/opnsense opnsense.go
chmod +x ./dist/pkg/usr/local/bin/opnsense
SHA=$(sha256sum ./dist/pkg/usr/local/bin/opnsense | awk '{ print $1 }')

VERSION=$1
FLATSIZE=$(du -b -s ./dist/pkg/usr/local/bin | cut -f1)
MANIFEST="./dist/pkg/+MANIFEST"
echo -e "{\n\"name\": \"opnsense-cli\"," > $MANIFEST
echo -e "\"version\": \"${VERSION}\"," >> $MANIFEST
echo -e "\"origin\": \"net-mgmt/opnsense-cli\"," >> $MANIFEST
echo -e "\"comment\": \"CLI to manage and monitor OPNsense firewall configuration, check status, change settings, and execute commands.\"," >> $MANIFEST
echo -e "\"desc\": \"opnsense is a command-line utility for managing, configuring, and monitoring OPNsense firewall systems. It facilitates non-GUI administration, both directly in the shell and remotely via an SSH tunnel.\"," >> $MANIFEST
echo -e "\"maintainer\": \"[email protected]\"," >> $MANIFEST
echo -e "\"www\": \"https://github.com/mihakralj/opnsense-cli\"," >> $MANIFEST
echo -e "\"abi\": \"FreeBSD:*:amd64\"," >> $MANIFEST
echo -e "\"prefix\": \"/usr/local\"," >> $MANIFEST
echo -e "\"flatsize\": ${FLATSIZE}," >> $MANIFEST
echo -e "\"licenselogic\": \"single\"," >> $MANIFEST
echo -e "\"licenses\": [\"APACHE20\"]," >> $MANIFEST
echo -e "\"files\": {" >> $MANIFEST
echo -e "\"/usr/local/bin/opnsense\": \"SHA256:$SHA\"" >> $MANIFEST
echo -e "}" >> $MANIFEST
echo -e "}" >> $MANIFEST

MANIFEST="./dist/pkg/+COMPACT_MANIFEST"
echo -e "{\n\"name\": \"opnsense-cli\"," > $MANIFEST
echo -e "\"version\": \"${VERSION}\"," >> $MANIFEST
echo -e "\"origin\": \"net-mgmt/opnsense-cli\"," >> $MANIFEST
echo -e "\"comment\": \"CLI to manage and monitor OPNsense firewall configuration, check status, change settings, and execute commands.\"," >> $MANIFEST
echo -e "\"www\": \"https://github.com/mihakralj/opnsense-cli\"," >> $MANIFEST
echo -e "\"abi\": \"FreeBSD:*:amd64\"," >> $MANIFEST
echo -e "}" >> $MANIFEST

cd ./dist/pkg
tar --absolute-names -cJf ../opnsense-cli-${VERSION}.txz -C . +MANIFEST +COMPACT_MANIFEST /usr/local/bin/opnsense
25 changes: 12 additions & 13 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
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 ./...

builds:
- env:
- CGO_ENABLED=0
- GOARCH=amd64
- GOOS=freebsd
binary: opnsense
goos:
- freebsd
- linux
- windows
- darwin
goarch:
- amd64
hooks:
post:
- ./.github/make_manifest.sh {{.Version}}

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
name_template: "{{ incpatch .Version }}"



# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
Expand Down

0 comments on commit 8bd73bb

Please sign in to comment.