Skip to content

Commit 962988e

Browse files
bepclaude
andcommitted
Add test scripts for publish command
- Update all.txt with publish assertions - Add dedicated publish.txt test for homebrew cask functionality Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 1388085 commit 962988e

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

testscripts/commands/all.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ env GITHUB_TOKEN=faketoken
66
hugoreleaser all -tag v1.2.0 -commitish main
77
! stderr .
88

9+
# Release assertions
910
stdout 'Prepared 2 files'
1011
stdout 'Uploading'
1112

13+
# Publish assertions (no homebrew cask enabled, so just check release publish)
14+
stdout 'GetReleaseByTag'
15+
stdout 'PublishRelease'
16+
1217
# Test files
1318
-- hugoreleaser.yaml --
1419
project: hugo

testscripts/commands/publish.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
# faketoken is a magic string that will create a FakeClient.
3+
env GITHUB_TOKEN=faketoken
4+
5+
# Run publish command with pre-created release artifacts.
6+
hugoreleaser publish -tag v1.2.0
7+
! stderr .
8+
9+
# Check that it found and published the release
10+
stdout 'GetReleaseByTag.*owner=bep.*repo=hugoreleaser.*tag=v1.2.0'
11+
stdout 'PublishRelease'
12+
13+
# Check that it updated the homebrew cask
14+
stdout 'Found pkg archive.*hugo_1.2.0_darwin-universal.pkg'
15+
stdout 'UpdateFileInRepo.*owner=bep.*repo=homebrew-tap.*path=Casks/hugo.rb'
16+
17+
# Test files
18+
-- hugoreleaser.yaml --
19+
project: hugo
20+
release_settings:
21+
type: github
22+
repository: hugoreleaser
23+
repository_owner: bep
24+
draft: true
25+
build_settings:
26+
binary: hugo
27+
archive_settings:
28+
name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}"
29+
type:
30+
format: tar.gz
31+
extension: .pkg
32+
publish_settings:
33+
homebrew_cask:
34+
enabled: true
35+
bundle_identifier: io.gohugo.hugo
36+
builds:
37+
- path: mac
38+
os:
39+
- goos: darwin
40+
archs:
41+
- goarch: universal
42+
archives:
43+
- paths:
44+
- builds/mac/**
45+
releases:
46+
- paths:
47+
- archives/**
48+
path: myrelease
49+
50+
# Pre-created release artifacts (simulating what release command would create)
51+
-- dist/hugo/v1.2.0/releases/myrelease/hugo_1.2.0_checksums.txt --
52+
abc123def456 hugo_1.2.0_darwin-universal.pkg
53+
54+
-- go.mod --
55+
module foo
56+
-- main.go --
57+
package main
58+
func main() {
59+
60+
}

0 commit comments

Comments
 (0)