Skip to content

Commit 1d2be18

Browse files
mascizmoog
andauthored
CI: Publish binary to a Homebrew Cask (#64)
* ci: automate homebrew release * remove flag * try * Update cask and add install steps --------- Co-authored-by: Maurizio Branca <maurizio.branca@elastic.co>
1 parent 2c06161 commit 1d2be18

3 files changed

Lines changed: 71 additions & 95 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,35 @@
11
name: release
22

33
on:
4+
workflow_dispatch:
45
push:
56
# run only against tags
67
tags:
7-
- '*'
8+
- "v[0-9].[0-9]+.[0-9]+*"
89

910
permissions:
1011
contents: write
11-
# packages: write
12-
# issues: write
1312

1413
jobs:
1514
goreleaser:
16-
# macOS notarization toolchain works only on macOS
1715
runs-on: macos-latest
1816
steps:
1917
- name: Checkout
2018
uses: actions/checkout@v5
2119
with:
2220
fetch-depth: 0
23-
- name: Fetch all tags
24-
run: git fetch --force --tags
21+
fetch-tags: true
22+
2523
- name: Set up Go
2624
uses: actions/setup-go@v6
2725
with:
2826
go-version: 1.25.3
29-
#
30-
# Uncomment the following lines if you want to use macOS notarization
31-
# ---------------------------------------------------------------
32-
#
33-
# I have commented out the following lines because I don't have a
34-
# paid Apple Developer account anymore.
35-
#
36-
# Since I'm probably the only one who will ever use this, I'm not
37-
# goint to spend $99/year until I have a good reason to do so.
38-
#
39-
# - name: Install gon for code signing and notarization
40-
# run: |
41-
# wget -q https://github.com/mitchellh/gon/releases/download/v0.2.5/gon_macos.zip -O /tmp/gon_macos.zip
42-
# unzip /tmp/gon_macos.zip -d /usr/local/bin
43-
# - name: Set up keychain for macOS code-signing and notarization
44-
# env:
45-
# KEYCHAIN_PATH: "/tmp/apple-developer.keychain-db"
46-
# run: |
47-
# echo "${{ secrets.KEYCHAIN_CONTENT }}" | base64 --decode > ${{ env.KEYCHAIN_PATH }}
48-
# security default-keychain -s ${{ env.KEYCHAIN_PATH }}
49-
# security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN_PATH }}"
50-
# git status
51-
27+
5228
- name: Run GoReleaser
5329
uses: goreleaser/goreleaser-action@v2
5430
with:
55-
# either 'goreleaser' (default) or 'goreleaser-pro'
5631
distribution: goreleaser
5732
version: latest
58-
args: release --rm-dist
33+
args: release --clean
5934
env:
60-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
62-
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
63-
AC_USERNAME: ${{ secrets.AC_USERNAME }}
64-
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
35+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

.goreleaser.yaml

Lines changed: 42 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,64 @@
1-
# This is an example .goreleaser.yml file with some sensible defaults.
2-
# Make sure to check the documentation at https://goreleaser.com
1+
version: 2
2+
33
before:
44
hooks:
55
# You may remove this if you don't use go modules.
66
- go mod tidy
77
# you may remove this if you don't need go generate
88
- go generate ./...
9+
10+
archives:
11+
- ids:
12+
- classeviva
13+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
14+
formats: ["tar.gz"]
15+
files:
16+
- README.md
17+
- LICENSE*
18+
919
builds:
10-
- binary: classeviva
20+
- binary: classeviva
1121
id: classeviva
1222
ldflags:
1323
- -s -w -X github.com/zmoog/classeviva/commands.version={{.Version}} -X github.com/zmoog/classeviva/commands.commit={{.Commit}} -X github.com/zmoog/classeviva/commands.date={{.Date}} -X github.com/zmoog/classeviva/commands.builtBy=goreleaser
1424
env:
1525
- CGO_ENABLED=0
1626
goos:
1727
- linux
18-
# - windows
1928
- darwin
29+
goarch:
30+
- amd64
31+
- arm64
2032
main: ./entrypoints/cli
21-
22-
#
23-
# Uncomment the following lines if you want to use macOS notarization
24-
# ---------------------------------------------------------------
25-
#
26-
# I have commented out the following lines because I don't have a
27-
# paid Apple Developer account anymore.
28-
#
29-
# Since I'm probably the only one who will ever use this, I'm not
30-
# goint to spend $99/year until I have a good reason to do so.
31-
#
32-
33-
# - binary: classeviva
34-
# id: classeviva-macos-amd64
35-
# ldflags:
36-
# - -s -w -X github.com/zmoog/classeviva/commands.version={{.Version}} -X github.com/zmoog/classeviva/commands.commit={{.Commit}} -X github.com/zmoog/classeviva/commands.date={{.Date}} -X github.com/zmoog/classeviva/commands.builtBy=goreleaser
37-
# env:
38-
# - CGO_ENABLED=0
39-
# goos:
40-
# - darwin
41-
# goarch:
42-
# - amd64
43-
# main: ./entrypoints/cli
44-
# hooks:
45-
# post:
46-
# - cmd: gon gon.config.amd64.hcl
47-
# output: true
48-
49-
# - binary: classeviva
50-
# id: classeviva-macos-arm64
51-
# ldflags:
52-
# - -s -w -X github.com/zmoog/classeviva/commands.version={{.Version}} -X github.com/zmoog/classeviva/commands.commit={{.Commit}} -X github.com/zmoog/classeviva/commands.date={{.Date}} -X github.com/zmoog/classeviva/commands.builtBy=goreleaser
53-
# env:
54-
# - CGO_ENABLED=0
55-
# goos:
56-
# - darwin
57-
# goarch:
58-
# - arm64
59-
# main: ./entrypoints/cli
60-
# hooks:
61-
# post:
62-
# - cmd: gon gon.config.arm64.hcl
63-
# output: true
64-
65-
archives:
66-
- replacements:
67-
darwin: Darwin
68-
linux: Linux
69-
# windows: Windows
70-
#386: i386
71-
amd64: x86_64
33+
34+
release:
35+
name_template: "{{.ProjectName}} v{{.Version}}"
36+
draft: false
37+
prerelease: auto
38+
39+
homebrew_casks:
40+
- name: classeviva
41+
repository:
42+
owner: zmoog
43+
name: homebrew-classeviva
44+
branch: main
45+
binaries:
46+
- classeviva
47+
hooks:
48+
post:
49+
install: |
50+
if OS.mac?
51+
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/classeviva"]
52+
end
7253
checksum:
73-
name_template: 'checksums.txt'
54+
name_template: "checksums.txt"
55+
7456
snapshot:
75-
name_template: "{{ incpatch .Version }}-next"
57+
version_template: "{{ incpatch .Version }}-next"
58+
7659
changelog:
7760
sort: asc
7861
filters:
7962
exclude:
80-
- '^docs:'
81-
- '^test:'
63+
- "^docs:"
64+
- "^test:"

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
Classeviva is a Go library and CLI tool to access the popular school portal https://web.spaggiari.eu.
44

5+
## Install
6+
7+
```sh
8+
brew install zmoog/homebrew-classeviva/classeviva
9+
```
10+
11+
```sh
12+
brew info classeviva
13+
==> classeviva: 0.2.0
14+
15+
Installed
16+
/opt/homebrew/Caskroom/classeviva/0.2.0 (6.8MB)
17+
Installed on 2025-10-30 at 14:47:56
18+
From: https://github.com/zmoog/homebrew-classeviva/blob/HEAD/Casks/classeviva.rb
19+
==> Name
20+
classeviva
21+
==> Description
22+
23+
==> Artifacts
24+
classeviva (Binary)
25+
```
26+
527
## Authentication
628

729
Classeviva supports multiple authentication methods with a priority chain, making it easy to manage credentials for multiple students.

0 commit comments

Comments
 (0)