Skip to content

Commit

Permalink
feat: packaging for deb, rpm, apk, aur (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
apricote authored May 9, 2024
1 parent 1c943e4 commit 139761c
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}
AUR_SSH_KEY: ${{ secrets.RELEASE_AUR_SSH_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

dist/
completions/
83 changes: 80 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@

version: 1

before:
hooks:
- ./scripts/completions.sh

builds:
- env:
- CGO_ENABLED=0
ldflags:
- -X {{ .ModulePath }}/internal/version.version={{ .Version }}
- -X {{ .ModulePath }}/internal/version.versionPrerelease=
goos:
- linux
- windows
- darwin
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -X {{ .ModulePath }}/internal/version.version={{ .Version }}
- -X {{ .ModulePath }}/internal/version.versionPrerelease=

archives:
- format: tar.gz
Expand All @@ -28,6 +35,76 @@ archives:
- goos: windows
format: zip

files:
- README.md
- LICENSE
- completions/*

nfpms:
- id: default
file_name_template: "{{ .ConventionalFileName }}"
package_name: hcloud-upload-image
vendor: Julian Tölle
homepage: https://github.com/apricote/hcloud-upload-image
maintainer: Julian Tölle <[email protected]>
formats:
- deb
- rpm
- apk
description: Manage custom OS images on Hetzner Cloud.
license: MIT
dependencies:
- openssh
recommends:
- hcloud-cli

contents:
- src: ./completions/hcloud-upload-image.bash
dst: /usr/share/bash-completion/completions/hcloud-upload-image
file_info:
mode: 0644
- src: ./completions/hcloud-upload-image.fish
dst: /usr/share/fish/vendor_completions.d/hcloud-upload-image.fish
file_info:
mode: 0644
- src: ./completions/hcloud-upload-image.zsh
dst: /usr/share/zsh/vendor-completions/_hcloud-upload-image
file_info:
mode: 0644
- src: ./LICENSE
dst: /usr/share/doc/hcloud-upload-image/license
file_info:
mode: 0644


aurs:
- name: hcloud-upload-image-bin
homepage: "https://github.com/apricote/hcloud-upload-image"
description: Manage custom OS images on Hetzner Cloud.
maintainers:
- "Julian Tölle <[email protected]>"
license: MIT
private_key: "{{ .Env.AUR_SSH_KEY }}"
git_url: "ssh://[email protected]/hcloud-upload-image-bin.git"
depends:
- openssh

package: |-
# bin
install -Dm755 "./hcloud-upload-image" "${pkgdir}/usr/bin/hcloud-upload-image"
# license
install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/hcloud-upload-image/LICENSE"
# completions
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/hcloud-upload-image.bash" "${pkgdir}/usr/share/bash-completion/completions/hcloud-upload-image"
install -Dm644 "./completions/hcloud-upload-image.zsh" "${pkgdir}/usr/share/zsh/site-functions/_hcloud-upload-image"
install -Dm644 "./completions/hcloud-upload-image.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/hcloud-upload-image.fish"
snapshot:
name_template: "{{ .Version }}-dev+{{ .ShortCommit }}"

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 . completion "$sh" >"completions/hcloud-upload-image.$sh"
done

0 comments on commit 139761c

Please sign in to comment.