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
22 changes: 4 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch: {} # allow manual runs
release:
types: [published] # run if you publish a release by hand
types: [published]

permissions:
contents: write
Expand All @@ -18,25 +14,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # tags required
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: 'go.mod'
- uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
args: release --clean --timeout=60m
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
SCOOP_GITHUB_TOKEN: ${{ secrets.SCOOP_GITHUB_TOKEN }}
WINGET_GITHUB_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }}
Binary file modified .gitignore
Binary file not shown.
73 changes: 31 additions & 42 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
version: 2

project_name: hottgo
project_name: hg

before:
hooks:
- go mod tidy

builds:
- id: hottgo
main: ./cmd/hottgo
binary: hottgo
- id: hg
main: ./cmd/hg
binary: hg
env:
- CGO_ENABLED=0
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
ldflags:
- -s -w
mod_timestamp: "{{ .CommitDate }}"
mod_timestamp: "{{ .CommitTimestamp }}"

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

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

checksum:
name_template: "checksums.txt"
Expand All @@ -55,26 +53,13 @@ release:
draft: false
prerelease: false

# Generate deb/rpm via nfpm (optional but useful for apt/yum repos)
nfpms:
- id: linux-packages
package_name: hottgo
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}"
builds: [hottgo]
vendor: watchthelight
maintainer: "watchthelight <admin@watchthelight.org>"
license: MIT
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
- name: hg
ids: [unix-tarballs]
skip_upload: true
repository:
owner: watchthelight
name: homebrew-hottgo
owner: TODO
name: TODO
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
commit_author:
name: watchthelight-bot
Expand All @@ -83,15 +68,19 @@ brews:
homepage: "https://github.com/watchthelight/HypergraphGo"
license: "MIT"
install: |
bin.install "hottgo"
bin.install "hg"

# Upload built artifacts + packages to Cloudsmith
publishers:
- name: cloudsmith
# Requires CLOUDSMITH_TOKEN env set in CI
cmd: >
cloudsmith push raw watchthelight/hottgo
--name "{{ .ArtifactName }}"
--version "{{ .Version }}"
"{{ .ArtifactPath }}"
ids: ["all"]
scoops:
- name: hg
ids: [windows-zips]
skip_upload: true
repository:
owner: TODO
name: TODO
token: "{{ .Env.SCOOP_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"
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>hottgo</id>
<id>hg</id>
<version>__REPLACE__</version>
<title>hottgo</title>
<title>hg</title>
<authors>watchthelight</authors>
<owners>watchthelight</owners>
<licenseUrl>https://github.com/watchthelight/HypergraphGo/blob/main/LICENSE</licenseUrl>
<projectUrl>https://github.com/watchthelight/HypergraphGo</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>hottgo is a CLI tool for Hypergraph operations.</description>
<description>hg is a CLI tool for Hypergraph operations.</description>
<summary>CLI tool for Hypergraph</summary>
<releaseNotes>https://github.com/watchthelight/HypergraphGo/releases</releaseNotes>
<copyright>Copyright 2025 watchthelight</copyright>
Expand Down
2 changes: 1 addition & 1 deletion packaging/chocolatey/tools/chocolateyinstall.ps1.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $ErrorActionPreference = 'Stop'

$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$url = 'https://github.com/watchthelight/HypergraphGo/releases/download/v$version$/hottgo_$version$_Windows_amd64.zip'
$url = 'https://github.com/watchthelight/HypergraphGo/releases/download/v$version$/$zipName$'

$checksum = '$sha256_amd64$'

Expand Down
19 changes: 12 additions & 7 deletions scripts/gen-choco.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,32 @@ try {

$lines = $checksums -split "`n"
$checksum = $null
$zipName = $null
foreach ($line in $lines) {
if ($line -match "hottgo_${Version}_Windows_amd64\.zip") {
$checksum = ($line -split " ")[0]
if ($line -match "_windows_amd64\.zip$") {
$parts = $line -split " "
$checksum = $parts[0]
$zipName = $parts[1]
break
}
}

if (-not $checksum) {
Write-Error "Checksum for hottgo_${Version}_Windows_amd64.zip not found"
if (-not $checksum -or -not $zipName) {
Write-Error "Checksum for Windows amd64 zip not found in checksums.txt"
exit 1
}

Write-Host "Found Windows amd64 zip: $zipName with checksum: $checksum"

$templatePath = "packaging/chocolatey/tools/chocolateyinstall.ps1.tmpl"
$installScriptPath = "packaging/chocolatey/tools/chocolateyinstall.ps1"

$template = Get-Content $templatePath -Raw
$installScript = $template -replace '\$version\$', $Version -replace '\$sha256_amd64\$', $checksum
$installScript = $template -replace '\$version\$', $Version -replace '\$sha256_amd64\$', $checksum -replace '\$zipName\$', $zipName
Set-Content $installScriptPath $installScript

# Update nuspec version
$nuspecPath = "packaging/chocolatey/hottgo.nuspec"
$nuspecPath = "packaging/chocolatey/hg.nuspec"
$nuspec = Get-Content $nuspecPath -Raw
$nuspec = $nuspec -replace '__REPLACE__', $Version
Set-Content $nuspecPath $nuspec
Expand All @@ -44,7 +49,7 @@ Set-Content $nuspecPath $nuspec
choco pack $nuspecPath

# Push
$nupkg = "hottgo.$Version.nupkg"
$nupkg = "hg.$Version.nupkg"
if (Test-Path $nupkg) {
choco push $nupkg --api-key $env:CHOCOLATEY_API_KEY
} else {
Expand Down
Loading