Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 43 additions & 9 deletions .github/workflows/chocolatey.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
name: chocolatey

on:
push:
tags: ["v*.*.*"]
release:
types: [published]

permissions:
contents: read

jobs:
chocolatey:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Chocolatey
- name: Checkout
uses: actions/checkout@v4
with:
# Pull the repo just so scripts are available
fetch-depth: 1

- name: Set VERSION from release tag
shell: pwsh
run: |
$tag = "${{ github.event.release.tag_name }}"
$ver = $tag -replace '^v',''
"VERSION=$ver" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
Write-Host "Resolved VERSION=$ver"

# Do NOT install Chocolatey; it already exists on the GitHub Windows runner

- name: Wait for checksums.txt to be available (max ~90s)
shell: pwsh
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- name: Extract version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $env:GITHUB_ENV
- name: Run gen-choco.ps1
run: .\scripts\gen-choco.ps1 -Version $env:VERSION
$tag = "${{ github.event.release.tag_name }}"
$url = "https://github.com/${{ github.repository }}/releases/download/$tag/checksums.txt"
$ok = $false
for ($i=0; $i -lt 30; $i++) {
try {
$resp = Invoke-WebRequest -Uri $url -UseBasicParsing -Method Head -TimeoutSec 10
if ($resp.StatusCode -eq 200) { $ok = $true; break }
} catch { Start-Sleep -Seconds 3 }
Start-Sleep -Seconds 3
}
if (-not $ok) {
Write-Error "checksums.txt not found at $url after waiting."
exit 1
}

- name: Generate & push Chocolatey package
shell: pwsh
env:
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
run: |
.\scripts\gen-choco.ps1 -Version $env:VERSION
132 changes: 72 additions & 60 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,97 @@
version: 2

project_name: hottgo

before:
hooks:
- go mod tidy

builds:
- id: cli
- id: hottgo
main: ./cmd/hottgo
binary: hottgo
env:
- CGO_ENABLED=0
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
binary: hottgo
ldflags:
- -s -w
- -X github.com/watchthelight/HypergraphGo/internal/version.Version={{.Version}}
- -X github.com/watchthelight/HypergraphGo/internal/version.Commit={{.Commit}}
- -X github.com/watchthelight/HypergraphGo/internal/version.Date={{.Date}}
mod_timestamp: "{{ .CommitDate }}"

archives:
- id: tgz
builds: [cli]
- id: unix-tarballs
builds: [hottgo]
format: tar.gz
# linux/darwin end up here
wrap_in_directory: false
files:
- LICENSE
- README.md
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

- id: windows-zips
builds: [hottgo]
format: zip
# windows ends up here automatically
wrap_in_directory: false
files:
- LICENSE
- README.md
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

checksums:
name_template: 'checksums.txt'
checksum:
name_template: "checksums.txt"

changelog:
use: github
sort: asc
filters:
exclude:
- "^ci:"
- "^docs:"
- "^test:"

release:
draft: false
prerelease: false

# Generate deb/rpm via nfpm (optional but useful for apt/yum repos)
nfpms:
- id: packages
builds: [cli]
formats:
- deb
- rpm
- apk
- archlinux
- id: linux-packages
package_name: hottgo
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}"
builds: [hottgo]
vendor: watchthelight
homepage: https://github.com/watchthelight/HypergraphGo
maintainer: watchthelight
description: HypergraphGo is a tool for working with hypergraphs.
maintainer: "watchthelight <admin@watchthelight.org>"
license: MIT
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
homepage: "https://github.com/watchthelight/HypergraphGo"
description: "Hypergraph & HoTT tooling in Go"
formats: [deb, rpm]
bindir: /usr/bin

# Homebrew (formula in your tap)
brews:
- name: hottgo
repository:
owner: watchthelight
name: homebrew-hottgo
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
commit_author:
name: watchthelight-bot
email: admin@watchthelight.org
description: "Hypergraph & HoTT tooling in Go"
homepage: "https://github.com/watchthelight/HypergraphGo"
license: "MIT"
install: |
bin.install "hottgo"

publish:
# Upload built artifacts + packages to Cloudsmith
publishers:
- name: cloudsmith
ids: [packages]
cloudsmiths:
- organization: watchthelight
repository: hottgo
distributions:
- deb: ubuntu/noble
- deb: ubuntu/jammy
- deb: debian/bookworm
- rpm: el/9
- rpm: fedora/40
- alpine: alpine/v3.20
- name: homebrew
homebrew:
name: hottgo
repository:
owner: watchthelight
name: homebrew-hottgo
cask: true
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
- name: scoop
scoop:
name: hottgo
repository:
owner: watchthelight
name: scoop-bucket
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
- name: winget
winget:
name: hottgo
repository:
owner: watchthelight
name: winget-pkgs
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
# Requires CLOUDSMITH_TOKEN env set in CI
cmd: >
cloudsmith push raw watchthelight/hottgo
--name "{{ .ArtifactName }}"
--version "{{ .Version }}"
"{{ .ArtifactPath }}"
ids: ["all"]
Loading
Loading