From ebd91df0b9211dd92df59ca04115854c9782bb12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 18 Dec 2024 18:30:13 +0100 Subject: [PATCH 1/4] github: Bump versions --- .github/workflows/test.yml | 6 +++--- go.mod | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbcc026..ffa9cfe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,12 +7,12 @@ jobs: test: strategy: matrix: - go-version: [1.21.x, 1.22.x] + go-version: [1.22.x, 1.23.x] platform: [ macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ matrix.go-version }} - name: Install staticcheck @@ -25,7 +25,7 @@ jobs: run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH shell: bash - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Fmt if: matrix.platform != 'windows-latest' # :( run: "diff <(gofmt -d .) <(printf '')" diff --git a/go.mod b/go.mod index 83410a8..0cee9d9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/gohugoio/hugoreleaser -go 1.19 +go 1.22.0 require ( github.com/bep/execrpc v0.7.1 From 76337b2643d6fbee8ab43581eba7b9968cde2a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 18 Dec 2024 18:34:26 +0100 Subject: [PATCH 2/4] Run go get -u and go mod tidy --- go.mod | 31 ++++++++---------- go.sum | 100 ++++++++++++++++----------------------------------------- 2 files changed, 41 insertions(+), 90 deletions(-) diff --git a/go.mod b/go.mod index 0cee9d9..e8e113b 100644 --- a/go.mod +++ b/go.mod @@ -3,46 +3,41 @@ module github.com/gohugoio/hugoreleaser go 1.22.0 require ( - github.com/bep/execrpc v0.7.1 - github.com/bep/helpers v0.4.0 + github.com/bep/execrpc v0.9.0 + github.com/bep/helpers v0.5.0 github.com/bep/logg v0.4.0 github.com/bep/workers v1.1.0 - github.com/fatih/color v1.16.0 - github.com/frankban/quicktest v1.14.3 + github.com/fatih/color v1.18.0 + github.com/frankban/quicktest v1.14.6 github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04 github.com/google/go-github/v45 v45.2.0 github.com/mattn/go-isatty v0.0.20 github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.1.1 + github.com/pelletier/go-toml/v2 v2.2.3 github.com/peterbourgon/ff/v3 v3.4.0 github.com/rogpeppe/go-internal v1.10.0 - golang.org/x/exp v0.0.0-20240213143201-ec583247a57a - golang.org/x/oauth2 v0.17.0 + golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 + golang.org/x/oauth2 v0.24.0 ) require ( github.com/bep/clocks v0.5.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/pkg/errors v0.9.1 // indirect - golang.org/x/crypto v0.19.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/sys v0.28.0 // indirect ) require ( github.com/gohugoio/hugoreleaser-plugins-api v0.7.0 - golang.org/x/sync v0.6.0 + golang.org/x/sync v0.10.0 ) -require ( - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-querystring v1.1.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.32.0 // indirect -) +require github.com/google/go-querystring v1.1.0 // indirect require ( github.com/gobwas/glob v0.2.3 - github.com/google/go-cmp v0.5.9 // indirect - github.com/kr/pretty v0.3.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect ) diff --git a/go.sum b/go.sum index ef54bbd..628a0f6 100644 --- a/go.sum +++ b/go.sum @@ -1,45 +1,39 @@ github.com/bep/clocks v0.5.0 h1:hhvKVGLPQWRVsBP/UB7ErrHYIO42gINVbvqxvYTPVps= github.com/bep/clocks v0.5.0/go.mod h1:SUq3q+OOq41y2lRQqH5fsOoxN8GbxSiT6jvoVVLCVhU= -github.com/bep/execrpc v0.7.1 h1:ExHlNt9immvo2We9fNnNquXXlGKX1FKrvYNG1ZXd1Fg= -github.com/bep/execrpc v0.7.1/go.mod h1:dhMMXFX/IfDRQrp4/EHqqYbYfHS53bF/9kiHIG/ChJw= -github.com/bep/helpers v0.4.0 h1:ab9veaAiWY4ST48Oxp5usaqivDmYdB744fz+tcZ3Ifs= -github.com/bep/helpers v0.4.0/go.mod h1:/QpHdmcPagDw7+RjkLFCvnlUc8lQ5kg4KDrEkb2Yyco= +github.com/bep/execrpc v0.9.0 h1:SIQnFxUIpJEbfR3FTp94OinpqBrZDQDVWbJ82pgJ77k= +github.com/bep/execrpc v0.9.0/go.mod h1:lGHGK8NX0KvfhlRNH/SebW1quHGwXFeE3Ba+2KLtmrM= +github.com/bep/helpers v0.5.0 h1:rneezhnG7GzLFlsEWO/EnleaBRuluBDGFimalO6Y50o= +github.com/bep/helpers v0.5.0/go.mod h1:dSqCzIvHbzsk5YOesp1M7sKAq5xUcvANsRoKdawxH4Q= github.com/bep/logg v0.4.0 h1:luAo5mO4ZkhA5M1iDVDqDqnBBnlHjmtZF6VAyTp+nCQ= github.com/bep/logg v0.4.0/go.mod h1:Ccp9yP3wbR1mm++Kpxet91hAZBEQgmWgFgnXX3GkIV0= github.com/bep/workers v1.1.0 h1:3Xw/1y/Fzjt8KBB4nCHfXcvyWH9h56iEwPquCjKphCc= github.com/bep/workers v1.1.0/go.mod h1:7kIESOB86HfR2379pwoMWNy8B50D7r99fRLUyPSNyCs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gohugoio/hugoreleaser-plugins-api v0.7.0 h1:GzQ+KYibq8Ltm3sfG5tNwZqoUcROGh5FTBJm8K6ba98= github.com/gohugoio/hugoreleaser-plugins-api v0.7.0/go.mod h1:zjt/fqbUJzhtSEEgaK7MeHu/x0RJ2stRvhgMgbO1Xr4= github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04 h1:VNOiFvTuhXc2eoDvBVQHsfxl1TTS2/EF1wFs1YttIlA= github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04/go.mod h1:P3JlkmIYwGFlTf8/MhkR4P+mvidrYo28Fudx4wcR7f0= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI= github.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -51,72 +45,34 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= -github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc= github.com/peterbourgon/ff/v3 v3.4.0/go.mod h1:zjJVUhx+twciwfDl0zBcFzl4dW8axCRyXE/eKY9RztQ= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= -golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 160eef49b3cd8d90e685b7b429f1df31eb89b365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 19 Dec 2024 09:04:52 +0100 Subject: [PATCH 3/4] Adjust for the new execrpc API --- cmd/archivecmd/archive.go | 35 ++++++++------------- cmd/corecmd/core.go | 7 ++--- go.mod | 11 +++++-- go.sum | 14 ++++++--- hugoreleaser.env | 2 +- hugoreleaser.toml | 4 +-- internal/archives/build.go | 19 +++--------- internal/plugins/plugins.go | 62 ++++++++++++++++++++++++++----------- main.go | 2 -- main_test.go | 11 +++---- test.sh | 2 ++ 11 files changed, 93 insertions(+), 76 deletions(-) create mode 100755 test.sh diff --git a/cmd/archivecmd/archive.go b/cmd/archivecmd/archive.go index 76f2821..371e3c5 100644 --- a/cmd/archivecmd/archive.go +++ b/cmd/archivecmd/archive.go @@ -21,7 +21,6 @@ import ( "os" "path" "path/filepath" - "time" "github.com/gohugoio/hugoreleaser-plugins-api/archiveplugin" "github.com/gohugoio/hugoreleaser/cmd/corecmd" @@ -64,7 +63,6 @@ func NewArchivist(core *corecmd.Core) *Archivist { return &Archivist{ core: core, } - } func (b *Archivist) Init() error { @@ -80,20 +78,19 @@ func (b *Archivist) Init() error { return nil } infoCtx := c.InfoLog.WithField("cmd", fmt.Sprintf("%s %s", commandName, p.ID)) - client, err := plugins.StartArchivePlugin(infoCtx, c.Config.GoSettings, p) + cfg := plugins.ArchivePluginConfig{ + Infol: infoCtx, + Try: c.Try, + GoSettings: c.Config.GoSettings, + Options: p, + Project: c.Config.Project, + Tag: c.Tag, + } + client, err := plugins.StartArchivePlugin(cfg) if err != nil { return fmt.Errorf("error starting archive plugin %q: %w", p.ID, err) } - // Send a heartbeat to the plugin to make sure it's alive. - heartbeat := fmt.Sprintf("heartbeat-%s", time.Now()) - resp, err := client.Execute(archiveplugin.Request{Heartbeat: heartbeat}) - if err != nil { - return fmt.Errorf("error testing archive plugin %q: %w", p.ID, err) - } - if resp.Heartbeat != heartbeat { - return fmt.Errorf("error testing archive plugin %q: unexpected heartbeat response", p.ID) - } infoCtx.Log(logg.String("Archive plugin started and ready for use")) c.PluginsRegistryArchive[p.ID] = client return nil @@ -134,15 +131,12 @@ func (b *Archivist) Exec(ctx context.Context, args []string) error { archPath := archPath archiveSettings := archive.ArchiveSettings arch := archPath.Arch - buildInfo := model.BuildInfo{ - Project: b.core.Config.Project, - Tag: b.core.Tag, - Goos: arch.Os.Goos, - Goarch: arch.Goarch, + goInfo := model.GoInfo{ + Goos: arch.Os.Goos, + Goarch: arch.Goarch, } r.Run(func() (err error) { - outDir := filepath.Join(archiveDistDir, filepath.FromSlash(archPath.Path)) outFilename := filepath.Join( @@ -174,7 +168,7 @@ func (b *Archivist) Exec(ctx context.Context, args []string) error { } buildRequest := archiveplugin.Request{ - BuildInfo: buildInfo, + GoInfo: goInfo, Settings: archiveSettings.CustomSettings, OutFilename: outFilename, } @@ -199,7 +193,6 @@ func (b *Archivist) Exec(ctx context.Context, args []string) error { archiveSettings, buildRequest, ) - if err != nil { return err } @@ -216,12 +209,10 @@ func (b *Archivist) Exec(ctx context.Context, args []string) error { } return nil - }) } } return r.Wait() - } diff --git a/cmd/corecmd/core.go b/cmd/corecmd/core.go index 04bec84..a5c1501 100644 --- a/cmd/corecmd/core.go +++ b/cmd/corecmd/core.go @@ -32,6 +32,7 @@ import ( "github.com/bep/logg/handlers/multi" "github.com/bep/workers" "github.com/gohugoio/hugoreleaser-plugins-api/archiveplugin" + apimodel "github.com/gohugoio/hugoreleaser-plugins-api/model" "github.com/gohugoio/hugoreleaser/internal/common/errorsh" "github.com/gohugoio/hugoreleaser/internal/common/logging" "github.com/gohugoio/hugoreleaser/internal/common/matchers" @@ -134,7 +135,7 @@ type Core struct { Workforce *workers.Workforce // Archive plugins started and ready to use. - PluginsRegistryArchive map[string]*execrpc.Client[archiveplugin.Request, archiveplugin.Response] + PluginsRegistryArchive map[string]*execrpc.Client[apimodel.Config, archiveplugin.Request, any, apimodel.Receipt] } // Exec function for this command. @@ -161,7 +162,6 @@ func (c *Core) RegisterFlags(fs *flag.FlagSet) { fs.DurationVar(&c.Timeout, "timeout", 55*time.Minute, "Global timeout.") fs.BoolVar(&c.Quiet, "quiet", false, "Don't output anything to stdout.") fs.BoolVar(&c.Try, "try", false, "Trial run, no builds, archives or releases.") - } // PreInit is called before the flags are parsed. @@ -353,7 +353,6 @@ func (c *Core) Init() error { defer f.Close() c.Config, err = config.DecodeAndApplyDefaults(f) - if err != nil { msg := "error decoding config file" switch v := err.(type) { @@ -416,7 +415,7 @@ func (c *Core) Init() error { } // Registry for archive plugins. - c.PluginsRegistryArchive = make(map[string]*execrpc.Client[archiveplugin.Request, archiveplugin.Response]) + c.PluginsRegistryArchive = make(map[string]*execrpc.Client[apimodel.Config, archiveplugin.Request, any, apimodel.Receipt]) return nil } diff --git a/go.mod b/go.mod index e8e113b..319749b 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 github.com/peterbourgon/ff/v3 v3.4.0 - github.com/rogpeppe/go-internal v1.10.0 + github.com/rogpeppe/go-internal v1.13.1 golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 golang.org/x/oauth2 v0.24.0 ) @@ -29,11 +29,14 @@ require ( ) require ( - github.com/gohugoio/hugoreleaser-plugins-api v0.7.0 + github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219160743-c3129de2a262 golang.org/x/sync v0.10.0 ) -require github.com/google/go-querystring v1.1.0 // indirect +require ( + github.com/google/go-querystring v1.1.0 // indirect + golang.org/x/tools v0.28.0 // indirect +) require ( github.com/gobwas/glob v0.2.3 @@ -41,3 +44,5 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect ) + +replace github.com/bep/execrpc => /Users/bep/dev/go/bep/execrpc diff --git a/go.sum b/go.sum index 628a0f6..d4d8e5d 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,12 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.0 h1:GzQ+KYibq8Ltm3sfG5tNwZqoUcROGh5FTBJm8K6ba98= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.0/go.mod h1:zjt/fqbUJzhtSEEgaK7MeHu/x0RJ2stRvhgMgbO1Xr4= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219113101-e613cfc24c82 h1:IdctCMa9e/yCyJGQU7IeYmcYYHyiZccu5OcFwSOJoTo= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219113101-e613cfc24c82/go.mod h1:3pnrMYKsGrzACVwKU/R72UpRUnR+W7E5laXurS2QGMc= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219154512-07cffd8e9e37 h1:nyRm3Qt2Wl0dyEdPIsXkmmxXuRf5KSMtBC84s8p2h9E= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219154512-07cffd8e9e37/go.mod h1:3pnrMYKsGrzACVwKU/R72UpRUnR+W7E5laXurS2QGMc= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219160743-c3129de2a262 h1:T7uoNqJOnE1YiCs0bJus8J5ytTFfdZj31uNhb80GTcE= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219160743-c3129de2a262/go.mod h1:3pnrMYKsGrzACVwKU/R72UpRUnR+W7E5laXurS2QGMc= github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04 h1:VNOiFvTuhXc2eoDvBVQHsfxl1TTS2/EF1wFs1YttIlA= github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04/go.mod h1:P3JlkmIYwGFlTf8/MhkR4P+mvidrYo28Fudx4wcR7f0= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -55,8 +59,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= @@ -72,6 +76,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/hugoreleaser.env b/hugoreleaser.env index 0b01a40..c3e340f 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,3 +1,3 @@ # Next release -HUGORELEASER_TAG=v0.57.0 +HUGORELEASER_TAG=v0.58.0 HUGORELEASER_COMMITISH=main diff --git a/hugoreleaser.toml b/hugoreleaser.toml index 493c27d..f25d4e3 100644 --- a/hugoreleaser.toml +++ b/hugoreleaser.toml @@ -128,7 +128,7 @@ archive_alias_replacements = {} type = "gorun" # Note there is a "local" variant of this that may be simpler to set up, see # https://github.com/gohugoio/hugoreleaser-archive-plugins/tree/main/macospkg - command = "github.com/gohugoio/hugoreleaser-archive-plugins/macospkgremote@v0.1.1" + command = "github.com/gohugoio/hugoreleaser-archive-plugins/macospkgremote@newapi" [archives.archive_settings.custom_settings] # Package settings package_identifier = "io.gohugo.hugoreleaser" @@ -160,7 +160,7 @@ archive_alias_replacements = {} # If the plugin source lives locally, this can also be a file path, # e.g. './myplugin'. In those setups you may need to set dir to the directory path, # and use "." for the command. - command = "github.com/gohugoio/hugoreleaser-archive-plugins/deb@v0.6.1" + command = "github.com/gohugoio/hugoreleaser-archive-plugins/deb@newapi" [archives.archive_settings.custom_settings] # Custom settings as defined by the Deb plugin. vendor = "gohugo.io" diff --git a/internal/archives/build.go b/internal/archives/build.go index 555a6a5..0587aa4 100644 --- a/internal/archives/build.go +++ b/internal/archives/build.go @@ -18,7 +18,6 @@ import ( "fmt" "io" "os" - "time" "github.com/bep/logg" "github.com/gohugoio/hugoreleaser-plugins-api/archiveplugin" @@ -85,10 +84,6 @@ func Build(c *corecmd.Core, infoLogger logg.LevelLogger, settings config.Archive func buildExternal(c *corecmd.Core, infoLogger logg.LevelLogger, settings config.ArchiveSettings, req archiveplugin.Request) error { infoLogger = infoLogger.WithField("plugin", settings.Plugin.ID) - if c.Try { - req.Heartbeat = fmt.Sprintf("heartbeat-%s", time.Now()) - } - pluginSettings := settings.Plugin client, found := c.PluginsRegistryArchive[pluginSettings.ID] @@ -96,17 +91,13 @@ func buildExternal(c *corecmd.Core, infoLogger logg.LevelLogger, settings config return fmt.Errorf("archive plugin %q not found in registry", pluginSettings.ID) } - resp, err := client.Execute(req) - if err != nil { - return err - } - - if err := resp.Err(); err != nil { + result := client.Execute(req) + if err := result.Err(); err != nil { return err } - - if req.Heartbeat != resp.Heartbeat { - return fmt.Errorf("heartbeat mismatch: expected %q, got %q", req.Heartbeat, resp.Heartbeat) + receipt := <-result.Receipt() + if receipt.Error != nil { + return receipt.Error } return nil diff --git a/internal/plugins/plugins.go b/internal/plugins/plugins.go index eaf3256..a788014 100644 --- a/internal/plugins/plugins.go +++ b/internal/plugins/plugins.go @@ -22,13 +22,22 @@ import ( "github.com/bep/execrpc/codecs" "github.com/bep/logg" "github.com/gohugoio/hugoreleaser-plugins-api/archiveplugin" - "github.com/gohugoio/hugoreleaser-plugins-api/server" + "github.com/gohugoio/hugoreleaser-plugins-api/model" "github.com/gohugoio/hugoreleaser/internal/config" ) +type ArchivePluginConfig struct { + Infol logg.LevelLogger + Try bool + GoSettings config.GoSettings + Options config.Plugin + Project string + Tag string +} + // StartArchivePlugin starts a archive plugin. -func StartArchivePlugin(infoLogger logg.LevelLogger, goSettings config.GoSettings, options config.Plugin) (*execrpc.Client[archiveplugin.Request, archiveplugin.Response], error) { - env := options.Env +func StartArchivePlugin(cfg ArchivePluginConfig) (*execrpc.Client[model.Config, archiveplugin.Request, any, model.Receipt], error) { + env := cfg.Options.Env var hasGoProxy bool for _, e := range env { if strings.HasPrefix(e, "GOPROXY=") { @@ -37,28 +46,45 @@ func StartArchivePlugin(infoLogger logg.LevelLogger, goSettings config.GoSetting } } if !hasGoProxy { - env = append(env, "GOPROXY="+goSettings.GoProxy) + env = append(env, "GOPROXY="+cfg.GoSettings.GoProxy) + } + + serverCfg := model.Config{ + Version: 0, // TODO1 + Try: cfg.Try, + ProjectInfo: model.ProjectInfo{ + Project: cfg.Project, + Tag: cfg.Tag, + }, } - return execrpc.StartClient( - execrpc.ClientOptions[archiveplugin.Request, archiveplugin.Response]{ + client, err := execrpc.StartClient( + execrpc.ClientOptions[model.Config, archiveplugin.Request, any, model.Receipt]{ + Config: serverCfg, ClientRawOptions: execrpc.ClientRawOptions{ Version: 1, - Cmd: goSettings.GoExe, - Args: []string{"run", options.Command}, - Dir: options.Dir, + Cmd: cfg.GoSettings.GoExe, + Args: []string{"run", cfg.Options.Command}, + Dir: cfg.Options.Dir, Env: env, Timeout: 20 * time.Minute, - - OnMessage: func(msg execrpc.Message) { - statusCode := msg.Header.Status - switch statusCode { - case server.StatusInfoLog: - infoLogger.Log(logg.String(string(msg.Body))) - } - }, }, - Codec: codecs.TOMLCodec[archiveplugin.Request, archiveplugin.Response]{}, + Codec: codecs.TOMLCodec{}, }, ) + if err != nil { + return nil, err + } + + go func() { + for msg := range client.MessagesRaw() { + statusCode := msg.Header.Status + switch statusCode { + case model.StatusInfoLog: + cfg.Infol.Log(logg.String(string(msg.Body))) + } + } + }() + + return client, nil } diff --git a/main.go b/main.go index adcc638..57d0c76 100644 --- a/main.go +++ b/main.go @@ -118,7 +118,6 @@ func parseAndRun(args []string) (err error) { os.Setenv(envName, f.Value.String()) } } - }) ctx, cancel := context.WithTimeout(context.Background(), core.Timeout) @@ -157,5 +156,4 @@ func parseAndRun(args []string) (err error) { err = g.Wait() return err - } diff --git a/main_test.go b/main_test.go index 205baba..a35fba2 100644 --- a/main_test.go +++ b/main_test.go @@ -52,7 +52,7 @@ func TestMisc(t *testing.T) { setup := testSetupFunc() testscript.Run(t, testscript.Params{ Dir: "testscripts/misc", - //UpdateScripts: true, + // UpdateScripts: true, Setup: func(env *testscript.Env) error { return setup(env) }, @@ -69,8 +69,8 @@ func TestUnfinished(t *testing.T) { testscript.Run(t, testscript.Params{ Dir: "testscripts/unfinished", - //TestWork: true, - //UpdateScripts: true, + // TestWork: true, + // UpdateScripts: true, Setup: func(env *testscript.Env) error { return setup(env) }, @@ -128,7 +128,7 @@ func TestMain(m *testing.M) { fatalf("%v", err) } b = bytes.Replace(b, []byte("\r\n"), []byte{'\n'}, -1) - if err := os.WriteFile(filename, b, 0666); err != nil { + if err := os.WriteFile(filename, b, 0o666); err != nil { fatalf("%v", err) } return 0 @@ -199,7 +199,6 @@ func TestMain(m *testing.M) { } return 0 - }, // cpdir copies a file. @@ -216,7 +215,7 @@ func TestMain(m *testing.M) { fromFile = filepath.Join(os.Getenv("SOURCE"), fromFile) } - if err := os.MkdirAll(filepath.Dir(toFile), 0755); err != nil { + if err := os.MkdirAll(filepath.Dir(toFile), 0o755); err != nil { fmt.Fprintln(os.Stderr, err) return 1 } diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..9975207 --- /dev/null +++ b/test.sh @@ -0,0 +1,2 @@ +go install +hugoreleaser archive -tag v0.58.0 \ No newline at end of file From 295189f1cafa3c88deb554a4a09bbca64f6d6af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 19 Dec 2024 17:32:11 +0100 Subject: [PATCH 4/4] Move config to github.com/goccy/go-yaml Mostly motivated by YAML anchors. --- .github/workflows/test.yml | 2 + README.md | 41 +++- cmd/corecmd/core.go | 7 +- go.mod | 7 +- go.sum | 14 +- hugoreleaser.toml | 182 ------------------ hugoreleaser.yaml | 132 +++++++++++++ internal/config/archive_config.go | 38 ++-- internal/config/build_config.go | 36 ++-- internal/config/config.go | 39 ++-- internal/config/config_test.go | 17 +- internal/config/decode.go | 8 +- internal/config/release_config.go | 51 +++-- internal/plugins/plugins.go | 9 +- testscripts/commands/all.txt | 67 ++++--- testscripts/commands/build_and_archive.txt | 111 +++++------ testscripts/commands/release.txt | 131 ++++++------- .../misc/archive_alias_replacements.txt | 108 +++++------ testscripts/misc/archive_plugin_deb.txt | 64 +++--- testscripts/misc/build_chunks.txt | 115 ++++++----- .../misc/build_macos_universal_binary.txt | 61 +++--- testscripts/misc/envvars.txt | 55 +++--- .../misc/errors-release-duplicate-archive.txt | 61 +++--- testscripts/misc/errors_common.txt | 2 +- testscripts/misc/errors_invalid_config.txt | 4 +- testscripts/misc/flag_quiet.txt | 34 ++-- testscripts/misc/flag_try.txt | 50 ++--- testscripts/misc/flags_in_env.txt | 57 +++--- .../misc/releasenotes-custom-template.txt | 59 +++--- testscripts/misc/releasenotes-short.txt | 67 ++++--- testscripts/misc/releasenotes.txt | 69 ++++--- testscripts/misc/segments.txt | 106 +++++----- watch_testscripts.sh | 4 +- 33 files changed, 900 insertions(+), 908 deletions(-) delete mode 100644 hugoreleaser.toml create mode 100644 hugoreleaser.yaml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ffa9cfe..b156a55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,8 @@ jobs: shell: bash - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 - name: Fmt if: matrix.platform != 'windows-latest' # :( run: "diff <(gofmt -d .) <(printf '')" diff --git a/README.md b/README.md index 7ea3b3e..bbb63ae 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,30 @@ ### Configuration File -Hugoreleaser reads its main configuration from a file named `hugoreleaser.toml` in the working directory. See [this project's configuration](./hugoreleaser.toml) for an annotated example. +Hugoreleaser reads its main configuration from a file named `hugoreleaser.yaml` in the working directory. See [this project's configuration](./hugoreleaser.yaml) for an annotated example. + + +### Definitions + +Hugoreleaser supports YAML anchors and aliases, and has a reserved section for `definitions`. This is useful for defining common settings that can be reused in multiple places, e.g. + +```yaml +definitions: + archive_type_zip: &archive_type_zip + type: + format: zip + extension: .zip + + - goarch: amd64 +archives: + - paths: + - builds/**/windows/** + archive_settings: *archive_type_zip +``` ### Archive Aliases -See Hugo's use [here](https://github.com/gohugoio/hugo/blob/ec02c537edf7c027e7470126eb913e84fb626216/hugoreleaser.toml#L11). +See Hugo's use [here](TODO(bep)). ### Template Expansion @@ -63,7 +82,7 @@ The order of presedence for environment variables/flags: A `hugoreleaser.env` file will, if found in the current directory, be parsed and loaded into the environment of the running process. The format is simple, a text files of key-value-pairs on the form `KEY=value`, empty lines and lines starting with `#` is ignored: -Environment variable expressions in `hugoreleaser.toml` on the form `${VAR}` will be expanded before it's parsed. +Environment variable expressions in `hugoreleaser.yaml` on the form `${VAR}` will be expanded before it's parsed. An example `hugoreleaser.env` with the enviromnent for the next release may look like this: @@ -76,12 +95,11 @@ MYPROJECT_RELEASE_DRAFT=false In the above, the variables prefixed `HUGORELEASER_` will be used to set the flags when running the `hugoreleaser` commands. -The other custom variables can be used in `hugoreleaser.toml`, e.g: +The other custom variables can be used in `hugoreleaser.yaml`, e.g: ```toml -[release_settings] - name = "${MYPROJECT_RELEASE_NAME}" - draft = "${MYPROJECT_RELEASE_DRAFT@U}" +release_settings: + name: ${MYPROJECT_RELEASE_NAME} ``` Note the special `@U` (_Unquoute_) syntax. The field `draft` is a boolean and cannot be quouted, but this would create ugly validation errors in TOML aware editors. The construct above signals that the quoutes (single or double) should be removed before doing any variable expansion. @@ -133,12 +151,15 @@ The config map `release_notes_settings` has 3 options for how to handle release 2. Set `generate_on_host=true` and let GitHub do it. 3. Set `generate=true` and let Hugoreleaser do it. -There are more details about change grouping etc. in this [this project's configuration](./hugoreleaser.toml). +There are more details about change grouping etc. in this [this project's configuration](./hugoreleaser.yaml). For the third option, you can set a custom release notes template to use in `template_filename`. See the default template in [staticfiles/templates/release-notes.gotmpl](./staticfiles/templates/release-notes.gotmpl) for an example. ## Why another Go release tool? -If you need a Go build/release tool with all the bells and whistles, check out [GoReleaser](https://github.com/goreleaser/goreleaser). This project was created because [Hugo](https://github.com/gohugoio/hugo) needed some features not on the road map of that project. +This project was created because [Hugo](https://github.com/gohugoio/hugo) had some issues that seemed unsolvable with Goreleaser: + +* We had a CI release that timed out a lot (1 hour). And since Goreleaser creates the tag as the first step, we often ended up having to delete the tag and start over, creating all sorts of issues. +* We wanted to add more build variants, but we couldn't. -Hugo has used this tool for all of its releases since [v0.102.0](https://github.com/gohugoio/hugo/releases/tag/v0.102.0). +Hugo has used this tool for all of its releases since [v0.102.0](https://github.com/gohugoio/hugo/releases/tag/v0.102.0), and the release time has gone down from 50-60 minutes to around 10 minutes. diff --git a/cmd/corecmd/core.go b/cmd/corecmd/core.go index a5c1501..19b1ead 100644 --- a/cmd/corecmd/core.go +++ b/cmd/corecmd/core.go @@ -77,6 +77,8 @@ func New() (*ffcli.Command, *Core) { }, &cfg } +const configName = "hugoreleaser.yaml" + // Core holds common config settings and objects. type Core struct { // The parsed config. @@ -157,7 +159,6 @@ func (c *Core) RegisterFlags(fs *flag.FlagSet) { fs.StringVar(&c.Tag, "tag", "", "The name of the release tag (e.g. v1.2.0). Does not need to exist.") fs.Var(&c.Paths, "paths", "Paths to include in the command.") fs.StringVar(&c.DistDir, "dist", "dist", "Directory to store the built artifacts in.") - fs.StringVar(&c.ConfigFile, "config", "hugoreleaser.toml", "The config file to use.") fs.IntVar(&c.NumWorkers, "workers", numWorkers, "Number of parallel builds.") fs.DurationVar(&c.Timeout, "timeout", 55*time.Minute, "Global timeout.") fs.BoolVar(&c.Quiet, "quiet", false, "Don't output anything to stdout.") @@ -342,9 +343,7 @@ func (c *Core) Init() error { c.NumWorkers = runtime.NumCPU() } - if !filepath.IsAbs(c.ConfigFile) { - c.ConfigFile = filepath.Join(c.ProjectDir, c.ConfigFile) - } + c.ConfigFile = filepath.Join(c.ProjectDir, configName) f, err := os.Open(c.ConfigFile) if err != nil { diff --git a/go.mod b/go.mod index 319749b..afdea22 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/gohugoio/hugoreleaser go 1.22.0 require ( - github.com/bep/execrpc v0.9.0 + github.com/bep/execrpc v0.10.0 github.com/bep/helpers v0.5.0 github.com/bep/logg v0.4.0 github.com/bep/workers v1.1.0 @@ -29,7 +29,8 @@ require ( ) require ( - github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219160743-c3129de2a262 + github.com/goccy/go-yaml v1.15.11 + github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241220094410-1f02562cf9b9 golang.org/x/sync v0.10.0 ) @@ -44,5 +45,3 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect ) - -replace github.com/bep/execrpc => /Users/bep/dev/go/bep/execrpc diff --git a/go.sum b/go.sum index d4d8e5d..7d048d5 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/bep/clocks v0.5.0 h1:hhvKVGLPQWRVsBP/UB7ErrHYIO42gINVbvqxvYTPVps= github.com/bep/clocks v0.5.0/go.mod h1:SUq3q+OOq41y2lRQqH5fsOoxN8GbxSiT6jvoVVLCVhU= -github.com/bep/execrpc v0.9.0 h1:SIQnFxUIpJEbfR3FTp94OinpqBrZDQDVWbJ82pgJ77k= -github.com/bep/execrpc v0.9.0/go.mod h1:lGHGK8NX0KvfhlRNH/SebW1quHGwXFeE3Ba+2KLtmrM= +github.com/bep/execrpc v0.10.0 h1:Y8S8pZOFZI/zo95RMqgri98eIFaZEqZ41tbF89hSx/A= +github.com/bep/execrpc v0.10.0/go.mod h1:lGHGK8NX0KvfhlRNH/SebW1quHGwXFeE3Ba+2KLtmrM= github.com/bep/helpers v0.5.0 h1:rneezhnG7GzLFlsEWO/EnleaBRuluBDGFimalO6Y50o= github.com/bep/helpers v0.5.0/go.mod h1:dSqCzIvHbzsk5YOesp1M7sKAq5xUcvANsRoKdawxH4Q= github.com/bep/logg v0.4.0 h1:luAo5mO4ZkhA5M1iDVDqDqnBBnlHjmtZF6VAyTp+nCQ= @@ -18,12 +18,10 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219113101-e613cfc24c82 h1:IdctCMa9e/yCyJGQU7IeYmcYYHyiZccu5OcFwSOJoTo= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219113101-e613cfc24c82/go.mod h1:3pnrMYKsGrzACVwKU/R72UpRUnR+W7E5laXurS2QGMc= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219154512-07cffd8e9e37 h1:nyRm3Qt2Wl0dyEdPIsXkmmxXuRf5KSMtBC84s8p2h9E= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219154512-07cffd8e9e37/go.mod h1:3pnrMYKsGrzACVwKU/R72UpRUnR+W7E5laXurS2QGMc= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219160743-c3129de2a262 h1:T7uoNqJOnE1YiCs0bJus8J5ytTFfdZj31uNhb80GTcE= -github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241219160743-c3129de2a262/go.mod h1:3pnrMYKsGrzACVwKU/R72UpRUnR+W7E5laXurS2QGMc= +github.com/goccy/go-yaml v1.15.11 h1:XeEd/2INF0TXXWMzJ9ALqJLGjGDl4PIi1gmrK+7KpAs= +github.com/goccy/go-yaml v1.15.11/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241220094410-1f02562cf9b9 h1:JT6XVa3wBdkwrgcV4EYku7fZOfLX2MjWgWWtHtp5IQs= +github.com/gohugoio/hugoreleaser-plugins-api v0.7.1-0.20241220094410-1f02562cf9b9/go.mod h1:Qheg3q6TF7pq9etJBNceTqGaM1VfkYDnm2k2KIIC/Ac= github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04 h1:VNOiFvTuhXc2eoDvBVQHsfxl1TTS2/EF1wFs1YttIlA= github.com/gohugoio/hugoreleaser/plugins v0.1.1-0.20220822083757-38d81884db04/go.mod h1:P3JlkmIYwGFlTf8/MhkR4P+mvidrYo28Fudx4wcR7f0= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= diff --git a/hugoreleaser.toml b/hugoreleaser.toml deleted file mode 100644 index f25d4e3..0000000 --- a/hugoreleaser.toml +++ /dev/null @@ -1,182 +0,0 @@ -project = "hugoreleaser" - -# Create archive aliases (copies) for base archive filenames -# which contains the string on the left, e.g. -# { "linux-64bit" = "linux-amd64" }. -# -# The common use case is to to preserve some backward compability on name changes, -# the example above is taken from Hugo. -# You can include any extension in the above to limit this to e.g. only .deb archives. -archive_alias_replacements = {} - -# Go settings can be set on any of Project > Build. -# See Build settings for merge rules. -[go_settings] - # go_proxy will be used to set GOPROXY when running Go. - # It will default to 'https://proxy.golang.org' if not set. - # - # See https://proxy.golang.org/ for more information. - go_proxy = "https://proxy.golang.org" - go_exe = "go" - -# Build settings can be set on any of Project > Build > Goos > Goarch. -# Zero values (empty strings, 0 numbers) and nil slices/maps wil inherit values from the nearest non-zero value above for a key. -# Empty slices and maps will stay empty (e.g. `env = []`) -[build_settings] - binary = "hugoreleaser" - flags = ["-buildmode", "exe"] - env = ["CGO_ENABLED=0"] - ldflags = "" - -# Archive settings can be set on any of Project > Archive. -# Follows the same merge rules as Build settings. -[archive_settings] - name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" - # Extra, as in: In addition to the binary. - extra_files = [ - { source_path = "README.md", target_path = "README.md" }, - { source_path = "LICENSE", target_path = "LICENSE" }, - ] - [archive_settings.type] - format = "tar.gz" - extension = ".tar.gz" - -[release_settings] - name = "${HUGORELEASER_TAG}" - type = "github" - repository = "hugoreleaser" - repository_owner = "gohugoio" - - draft = true - prerelease = false - - [release_settings.release_notes_settings] - # Use Hugoreleaser's autogenerated release notes. - generate = true - # Enable this to use GitHub's autogenerated release notes. - generate_on_host = false - - # Set this if you have release notes file ready to use. - filename = "" - - # A custom template filename for Hugoreleaser's autogenerated release notes. - # Will fall back to the default if not set. - template_filename = "" - - # Collapse relases with < 10 changes below one title. - short_threshold = 10 - short_title = "What's Changed" - - groups = [ - # Group the changes in the release notes by title. - # You need at least one. - # The groups will be tested in order until a match is found. - # The titles will, by default, be listed in the given order in the release note. - # You can set an optional ordinal to adjust the order (as in the setup below). - # Any match with ignore=true will be dropped. - { regexp = "snapcraft:|Merge commit|Squashed", ignore = true }, - { title = "Bug fixes", regexp = "fix", ordinal = 20 }, - { title = "Dependency Updates", regexp = "deps", ordinal = 30 }, - { title = "Documentation", regexp = "doc", ordinal = 40 }, - { title = "Improvements", regexp = ".*", ordinal = 10 }, - ] - -[[builds]] - # User-defined path. Can be used to partition the build/archive step, e.g.: - # - # hugoreleaser build -paths "builds/unix/**" - # - # The above would only build binaries matching the given path ("Unix binaries"). - path = "unix" - - [[builds.os]] - goos = "linux" - [[builds.os.archs]] - goarch = "amd64" - -[[builds]] - path = "macos" - - [[builds.os]] - goos = "darwin" - [[builds.os.archs]] - goarch = "universal" - -[[builds]] - path = "windows" - - [[builds.os]] - goos = "windows" - [builds.os.build_settings] - binary = "hugoreleaser.exe" - [[builds.os.archs]] - goarch = "amd64" - -[[archives]] - paths = ["builds/unix/**"] -[[archives]] - paths = ["builds/macos/**"] - [archives.archive_settings] - extra_files = [] - [archives.archive_settings.type] - # When format is _plugin, - # archive_settings.plugin must also be configured. - format = "_plugin" - extension = ".pkg" - [archives.archive_settings.plugin] - id = "macospkgremote" - type = "gorun" - # Note there is a "local" variant of this that may be simpler to set up, see - # https://github.com/gohugoio/hugoreleaser-archive-plugins/tree/main/macospkg - command = "github.com/gohugoio/hugoreleaser-archive-plugins/macospkgremote@newapi" - [archives.archive_settings.custom_settings] - # Package settings - package_identifier = "io.gohugo.hugoreleaser" - package_version = "${HUGORELEASER_TAG}" - - # Apple settings. Only needed in the "local" variant of this plugin. - # apple_signing_identity = "${BUILDPKG_APPLE_DEVELOPER_SIGNING_IDENTITY}" - - # AWS Settings - bucket = "s3fptest" - queue = "https://sqs.eu-north-1.amazonaws.com/656975317043/s3fptest_client" - access_key_id = "${S3RPC_CLIENT_ACCESS_KEY_ID}" - secret_access_key = "${S3RPC_CLIENT_SECRET_ACCESS_KEY}" - -[[archives]] - paths = ["builds/**/linux/amd64"] - [archives.archive_settings] - binary_dir = "/usr/local/bin" - extra_files = [] - [archives.archive_settings.type] - # When format is _plugin, - # archive_settings.plugin must also be configured. - format = "_plugin" - extension = ".deb" - [archives.archive_settings.plugin] - id = "deb" - # gorun is currently the only type. - type = "gorun" - # If the plugin source lives locally, this can also be a file path, - # e.g. './myplugin'. In those setups you may need to set dir to the directory path, - # and use "." for the command. - command = "github.com/gohugoio/hugoreleaser-archive-plugins/deb@newapi" - [archives.archive_settings.custom_settings] - # Custom settings as defined by the Deb plugin. - vendor = "gohugo.io" - homepage = "https://github.com/gohugoio/hugoreleaser" - maintainer = "Bjørn Erik Pedersen " - description = "Build, archive and release Go programs." - license = "Apache-2.0" -[[archives]] - paths = ["builds/windows/**"] - [archives.archive_settings] - [archives.archive_settings.type] - format = "zip" - extension = ".zip" - -[[releases]] - paths = ["archives/**"] - # In this file we have only one release, but path can be used to partition the release step, e.g.: - # hugoreleaser release -paths "releases/myrelease" - path = "myrelease" diff --git a/hugoreleaser.yaml b/hugoreleaser.yaml new file mode 100644 index 0000000..d9f6731 --- /dev/null +++ b/hugoreleaser.yaml @@ -0,0 +1,132 @@ +project: hugoreleaser + +# definitions can be used to define anchors for common blocks and values. +# But note that build_settings and archive_settings can be set on any level and will merged downwards. +# Any zero config value will be replaced with the first non-zero value found above. +definitions: + +# Useful if you have changed archive naming scheme, but want to preserve some backwards compability with the most +# common variants, e.g. "linux-amd64.tar.gz: Linux-64bit.tar.gz" +archive_alias_replacements: {} + +go_settings: + go_proxy: https://proxy.golang.org + go_exe: go + +# This can be overridden for each build, goos, or goarch if needed. +build_settings: + binary: hugoreleaser + flags: + - -buildmode + - exe + env: + - CGO_ENABLED=0 + ldflags: "" + +# This can be overridden for each archive. +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: README.md + target_path: README.md + - source_path: LICENSE + target_path: LICENSE + type: + format: tar.gz + extension: .tar.gz +release_settings: + name: ${HUGORELEASER_TAG} + type: github + repository: hugoreleaser + repository_owner: gohugoio + draft: true + prerelease: false + release_notes_settings: + generate: true + generate_on_host: false + filename: "" + template_filename: "" + short_threshold: 10 + short_title: What's Changed + groups: + - regexp: snapcraft:|Merge commit|Squashed + ignore: true + - title: Bug fixes + regexp: fix + ordinal: 20 + - title: Dependency Updates + regexp: deps + ordinal: 30 + - title: Documentation + regexp: doc + ordinal: 40 + - title: Improvements + regexp: .* + ordinal: 10 +builds: + - path: unix + os: + - goos: linux + archs: + - goarch: amd64 + - path: macos + os: + - goos: darwin + archs: + - goarch: universal + - path: windows + os: + - goos: windows + build_settings: + binary: hugoreleaser.exe + archs: + - goarch: amd64 +archives: + - paths: + - builds/unix/** + - paths: + - builds/macos/** + archive_settings: + extra_files: [] + type: + format: _plugin + extension: .pkg + plugin: + id: macospkgremote + type: gorun + command: github.com/gohugoio/hugoreleaser-archive-plugins/macospkgremote@latest + custom_settings: + package_identifier: io.gohugo.hugoreleaser + package_version: ${HUGORELEASER_TAG} + bucket: s3fptest + queue: https://sqs.eu-north-1.amazonaws.com/656975317043/s3fptest_client + access_key_id: ${S3RPC_CLIENT_ACCESS_KEY_ID} + secret_access_key: ${S3RPC_CLIENT_SECRET_ACCESS_KEY} + - paths: + - builds/**/linux/amd64 + archive_settings: + binary_dir: /usr/local/bin + extra_files: [] + type: + format: _plugin + extension: .deb + plugin: + id: deb + type: gorun + command: github.com/gohugoio/hugoreleaser-archive-plugins/deb@latest + custom_settings: + vendor: gohugo.io + homepage: https://github.com/gohugoio/hugoreleaser + maintainer: Bjørn Erik Pedersen + description: Build, archive and release Go programs. + license: Apache-2.0 + - paths: + - builds/windows/** + archive_settings: + type: + format: zip + extension: .zip +releases: + - paths: + - archives/** + path: myrelease diff --git a/internal/config/archive_config.go b/internal/config/archive_config.go index ca10b99..2c86daf 100644 --- a/internal/config/archive_config.go +++ b/internal/config/archive_config.go @@ -31,11 +31,11 @@ var ( type Archive struct { // Glob of Build paths to archive. Multiple paths will be ANDed. - Paths []string `toml:"paths"` - ArchiveSettings ArchiveSettings `toml:"archive_settings"` + Paths []string `json:"paths"` + ArchiveSettings ArchiveSettings `json:"archive_settings"` - PathsCompiled matchers.Matcher `toml:"-"` - ArchsCompiled []BuildArchPath `toml:"-"` + PathsCompiled matchers.Matcher `json:"-"` + ArchsCompiled []BuildArchPath `json:"-"` } func (a *Archive) Init() error { @@ -63,30 +63,30 @@ func (a *Archive) Init() error { } type BuildArchPath struct { - Arch BuildArch `toml:"arch"` - Path string `toml:"path"` + Arch BuildArch `json:"arch"` + Path string `json:"path"` // Name is the name of the archive with the extension. - Name string `toml:"name"` + Name string `json:"name"` // Any archive aliase names, with the extension. - Aliases []string `toml:"aliases"` + Aliases []string `json:"aliases"` } type ArchiveSettings struct { - Type ArchiveType `toml:"type"` + Type ArchiveType `json:"type"` - BinaryDir string `toml:"binary_dir"` - NameTemplate string `toml:"name_template"` - ExtraFiles []ArchiveFileInfo `toml:"extra_files"` - Replacements map[string]string `toml:"replacements"` - Plugin Plugin `toml:"plugin"` + BinaryDir string `json:"binary_dir"` + NameTemplate string `json:"name_template"` + ExtraFiles []ArchiveFileInfo `json:"extra_files"` + Replacements map[string]string `json:"replacements"` + Plugin Plugin `json:"plugin"` // CustomSettings is archive type specific metadata. // See in the documentation for the configured archive type. - CustomSettings map[string]any `toml:"custom_settings"` + CustomSettings map[string]any `json:"custom_settings"` - ReplacementsCompiled *strings.Replacer `toml:"-"` + ReplacementsCompiled *strings.Replacer `json:"-"` } func (a *ArchiveSettings) Init() error { @@ -119,10 +119,10 @@ func (a *ArchiveSettings) Init() error { } type ArchiveType struct { - Format string `toml:"format"` - Extension string `toml:"extension"` + Format string `json:"format"` + Extension string `json:"extension"` - FormatParsed archiveformats.Format `toml:"-"` + FormatParsed archiveformats.Format `json:"-"` } func (a *ArchiveType) Init() error { diff --git a/internal/config/build_config.go b/internal/config/build_config.go index c969def..0267f1d 100644 --- a/internal/config/build_config.go +++ b/internal/config/build_config.go @@ -26,10 +26,10 @@ import ( var _ model.Initializer = (*Build)(nil) type Build struct { - Path string `toml:"path"` - Os []BuildOs `toml:"os"` + Path string `json:"path"` + Os []BuildOs `json:"os"` - BuildSettings BuildSettings `toml:"build_settings"` + BuildSettings BuildSettings `json:"build_settings"` } func (b *Build) Init() error { @@ -50,13 +50,13 @@ func (b Build) IsZero() bool { var _ logg.Fielder = BuildSettings{} type BuildSettings struct { - Binary string `toml:"binary"` + Binary string `json:"binary"` - Env []string `toml:"env"` - Ldflags string `toml:"ldflags"` - Flags []string `toml:"flags"` + Env []string `json:"env"` + Ldflags string `json:"ldflags"` + Flags []string `json:"flags"` - GoSettings GoSettings `toml:"go_settings"` + GoSettings GoSettings `json:"go_settings"` } // Fields is used by the logging framework. @@ -68,20 +68,20 @@ func (b BuildSettings) Fields() logg.Fields { } type GoSettings struct { - GoExe string `toml:"go_exe"` - GoProxy string `toml:"go_proxy"` + GoExe string `json:"go_exe"` + GoProxy string `json:"go_proxy"` } type Builds []Build type BuildArch struct { - Goarch string `toml:"goarch"` + Goarch string `json:"goarch"` - BuildSettings BuildSettings `toml:"build_settings"` + BuildSettings BuildSettings `json:"build_settings"` // Tree navigation. - Build *Build `toml:"-"` - Os *BuildOs `toml:"-"` + Build *Build `json:"-"` + Os *BuildOs `json:"-"` } // BinaryPath returns the path to the built binary starting below /builds. @@ -90,11 +90,11 @@ func (b BuildArch) BinaryPath() string { } type BuildOs struct { - Goos string `toml:"goos"` - Archs []BuildArch `toml:"archs"` + Goos string `json:"goos"` + Archs []BuildArch `json:"archs"` - BuildSettings BuildSettings `toml:"build_settings"` + BuildSettings BuildSettings `json:"build_settings"` // Tree navigation. - Build *Build `toml:"-"` + Build *Build `json:"-"` } diff --git a/internal/config/config.go b/internal/config/config.go index ef1403d..4640f9b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -23,18 +23,21 @@ import ( ) type Config struct { - Project string `toml:"project"` - ArchiveAliasReplacements map[string]string `toml:"archive_alias_replacements"` + // A bucket for anchors that defines reusable YAML fragments. + Definitions map[string]any ` json:"definitions"` - GoSettings GoSettings `toml:"go_settings"` + Project string `json:"project"` + ArchiveAliasReplacements map[string]string `json:"archive_alias_replacements"` - Builds Builds `toml:"builds"` - Archives Archives `toml:"archives"` - Releases Releases `toml:"releases"` + GoSettings GoSettings `json:"go_settings"` - BuildSettings BuildSettings `toml:"build_settings"` - ArchiveSettings ArchiveSettings `toml:"archive_settings"` - ReleaseSettings ReleaseSettings `toml:"release_settings"` + Builds Builds `json:"builds"` + Archives Archives `json:"archives"` + Releases Releases `json:"releases"` + + BuildSettings BuildSettings `json:"build_settings"` + ArchiveSettings ArchiveSettings `json:"archive_settings"` + ReleaseSettings ReleaseSettings `json:"release_settings"` } func (c Config) FindReleases(filter matchers.Matcher) []Release { @@ -66,13 +69,13 @@ func (c Config) FindArchs(filter matchers.Matcher) []BuildArchPath { } type Plugin struct { - ID string `toml:"id"` - Type string `toml:"type"` - Command string `toml:"command"` - Dir string `toml:"dir"` - Env []string `toml:"env"` + ID string `json:"id"` + Type string `json:"type"` + Command string `json:"command"` + Dir string `json:"dir"` + Env []string `json:"env"` - TypeParsed plugintypes.Type `toml:"-"` + TypeParsed plugintypes.Type `json:"-"` } func (t *Plugin) Clear() { @@ -105,7 +108,7 @@ func (t Plugin) IsZero() bool { } type ArchiveFileInfo struct { - SourcePath string `toml:"source_path"` - TargetPath string `toml:"target_path"` - Mode fs.FileMode `toml:"mode"` + SourcePath string `json:"source_path"` + TargetPath string `json:"target_path"` + Mode fs.FileMode `json:"mode"` } diff --git a/internal/config/config_test.go b/internal/config/config_test.go index ea3c74a..50642ed 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -20,8 +20,6 @@ import ( "strings" "testing" - "github.com/pelletier/go-toml/v2" - qt "github.com/frankban/quicktest" ) @@ -43,22 +41,13 @@ format = "foo" func TestDecodeFile(t *testing.T) { c := qt.New(t) - f, err := os.Open("../../hugoreleaser.toml") + f, err := os.Open("../../hugoreleaser.yaml") c.Assert(err, qt.IsNil) defer f.Close() cfg, err := DecodeAndApplyDefaults(f) if err != nil { - switch v := err.(type) { - case *toml.DecodeError: - row, col := v.Position() - fmt.Printf("%d:%d:%s:%v\n", row, col, v.Key(), v.Error()) - - case *toml.StrictMissingError: - fmt.Println(v.Errors) - default: - fmt.Printf("%v\n", err) - } + fmt.Printf("%v\n", err) } c.Assert(err, qt.IsNil) @@ -82,4 +71,6 @@ func TestDecodeFile(t *testing.T) { } } } + + fmt.Println("===> FI", cfg.ReleaseSettings.ReleaseNotesSettings.Filename) } diff --git a/internal/config/decode.go b/internal/config/decode.go index 4355973..be1b051 100644 --- a/internal/config/decode.go +++ b/internal/config/decode.go @@ -21,8 +21,9 @@ import ( "reflect" "strings" + "github.com/goccy/go-yaml" + "github.com/bep/helpers/envhelpers" - "github.com/pelletier/go-toml/v2" ) var zeroType = reflect.TypeOf((*zeroer)(nil)).Elem() @@ -46,9 +47,10 @@ func DecodeAndApplyDefaults(r io.Reader) (Config, error) { return os.Getenv(k) }) - d := toml.NewDecoder(strings.NewReader(s)) + d := yaml.NewDecoder(strings.NewReader(s), + yaml.DisallowUnknownField(), + ) - d.DisallowUnknownFields() err = d.Decode(cfg) if err != nil { return *cfg, err diff --git a/internal/config/release_config.go b/internal/config/release_config.go index 444beaf..9695a23 100644 --- a/internal/config/release_config.go +++ b/internal/config/release_config.go @@ -27,18 +27,18 @@ import ( type Release struct { // Paths with Glob of releases paths to release. Multiple paths will be ANDed. - Paths []string `toml:"paths"` + Paths []string `json:"paths"` // Path is the directory below /dist/releases where the release artifacts gets stored. // This must be unique for each release within one configuration file. - Path string `toml:"path"` + Path string `json:"path"` - ReleaseSettings ReleaseSettings `toml:"release_settings"` + ReleaseSettings ReleaseSettings `json:"release_settings"` - PathsCompiled matchers.Matcher `toml:"-"` + PathsCompiled matchers.Matcher `json:"-"` // Builds matching Paths. - ArchsCompiled []BuildArchPath `toml:"-"` + ArchsCompiled []BuildArchPath `json:"-"` } func (a *Release) Init() error { @@ -72,29 +72,29 @@ func (a *Release) Init() error { } type ReleaseSettings struct { - Type string `toml:"type"` + Type string `json:"type"` - Name string `toml:"name"` - Repository string `toml:"repository"` - RepositoryOwner string `toml:"repository_owner"` - Draft bool `toml:"draft"` - Prerelease bool `toml:"prerelease"` + Name string `json:"name"` + Repository string `json:"repository"` + RepositoryOwner string `json:"repository_owner"` + Draft bool `json:"draft"` + Prerelease bool `json:"prerelease"` - ReleaseNotesSettings ReleaseNotesSettings `toml:"release_notes_settings"` + ReleaseNotesSettings ReleaseNotesSettings `json:"release_notes_settings"` - TypeParsed releasetypes.Type `toml:"-"` + TypeParsed releasetypes.Type `json:"-"` } type ReleaseNotesSettings struct { - Generate bool `toml:"generate"` - GenerateOnHost bool `toml:"generate_on_host"` - Filename string `toml:"filename"` - TemplateFilename string `toml:"template_filename"` - Groups []ReleaseNotesGroup `toml:"groups"` + Generate bool `json:"generate"` + GenerateOnHost bool `json:"generate_on_host"` + Filename string `json:"filename"` + TemplateFilename string `json:"template_filename"` + Groups []ReleaseNotesGroup `json:"groups"` // Can be used to collapse releases with a few number (less than threshold) of changes into one title. - ShortThreshold int `toml:"short_threshold"` - ShortTitle string `toml:"short_title"` + ShortThreshold int `json:"short_threshold"` + ShortTitle string `json:"short_title"` } func (g *ReleaseNotesSettings) Init() error { @@ -107,12 +107,12 @@ func (g *ReleaseNotesSettings) Init() error { } type ReleaseNotesGroup struct { - Title string `toml:"title"` - Regexp string `toml:"regexp"` - Ignore bool `toml:"ignore"` - Ordinal int `toml:"ordinal"` + Title string `json:"title"` + Regexp string `json:"regexp"` + Ignore bool `json:"ignore"` + Ordinal int `json:"ordinal"` - RegexpCompiled matchers.Matcher `toml:"-"` + RegexpCompiled matchers.Matcher `json:"-"` } func (g *ReleaseNotesGroup) Init() error { @@ -136,7 +136,6 @@ func (g *ReleaseNotesGroup) Init() error { }) return nil - } func (r *ReleaseSettings) Init() error { diff --git a/internal/plugins/plugins.go b/internal/plugins/plugins.go index a788014..4cea2ec 100644 --- a/internal/plugins/plugins.go +++ b/internal/plugins/plugins.go @@ -26,6 +26,10 @@ import ( "github.com/gohugoio/hugoreleaser/internal/config" ) +// This represents a major version. +// Increment this only when there are breaking changes to the plugin protocol. +const pluginProtocolVersion = 2 + type ArchivePluginConfig struct { Infol logg.LevelLogger Try bool @@ -50,8 +54,7 @@ func StartArchivePlugin(cfg ArchivePluginConfig) (*execrpc.Client[model.Config, } serverCfg := model.Config{ - Version: 0, // TODO1 - Try: cfg.Try, + Try: cfg.Try, ProjectInfo: model.ProjectInfo{ Project: cfg.Project, Tag: cfg.Tag, @@ -62,7 +65,7 @@ func StartArchivePlugin(cfg ArchivePluginConfig) (*execrpc.Client[model.Config, execrpc.ClientOptions[model.Config, archiveplugin.Request, any, model.Receipt]{ Config: serverCfg, ClientRawOptions: execrpc.ClientRawOptions{ - Version: 1, + Version: pluginProtocolVersion, Cmd: cfg.GoSettings.GoExe, Args: []string{"run", cfg.Options.Command}, Dir: cfg.Options.Dir, diff --git a/testscripts/commands/all.txt b/testscripts/commands/all.txt index 35d72c3..34b9b0d 100644 --- a/testscripts/commands/all.txt +++ b/testscripts/commands/all.txt @@ -10,39 +10,42 @@ stdout 'Prepared 2 files' stdout 'Uploading' # Test files --- hugoreleaser.toml -- -project = "hugo" -[go_settings] -go_proxy = "https://proxy.golang.org" -go_exe = "go" -[build_settings] -binary = "hugo" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -draft = true -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -extra_files = [{ source_path = "README.md", target_path = "README.md" }, { source_path = "license.txt", target_path = "license.txt" }] -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" +-- hugoreleaser.yaml -- +project: hugo +go_settings: + go_proxy: https://proxy.golang.org + go_exe: go +build_settings: + binary: hugo +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + draft: true +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: README.md + target_path: README.md + - source_path: license.txt + target_path: license.txt + type: + format: tar.gz + extension: .tar.gz +builds: + - path: mac + os: + - goos: darwin + archs: + - goarch: arm64 +archives: + - paths: + - builds/mac/** +releases: + - paths: + - archives/** + path: myrelease -[[builds]] -path = "mac" - -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "arm64" - -[[archives]] -paths = ["builds/mac/**"] - -[[releases]] -paths = ["archives/**"] -path = "myrelease" -- go.mod -- module foo diff --git a/testscripts/commands/build_and_archive.txt b/testscripts/commands/build_and_archive.txt index 36a2e99..267f849 100644 --- a/testscripts/commands/build_and_archive.txt +++ b/testscripts/commands/build_and_archive.txt @@ -45,63 +45,66 @@ printarchive $WORK/dist/hugo/v1.2.0/archives/main/base/linux/amd64/hugo_1.2.0_li # It looks like nothing gets printed, so I suspect it's printarchive that somehow fails. [!windows] stdout '-rw-r--r-- 0644 README.md' [!windows] stdout '-rw-r---wx 0643 license.txt' -[!windows] stdout '-rw-r---w- 0642 subdir/myconfig.toml' +[!windows] stdout '-rw-r---w- 0642 subdir/myconfig.yaml' # Test files --- hugoreleaser.toml -- -project = "hugo" -[build_settings] -binary = "hugo" -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -extra_files = [{ source_path = "${READMEFILE}", target_path = "README.md" }, { source_path = "license.txt", target_path = "license.txt" }, { source_path = "hugoreleaser.toml", target_path = "subdir/myconfig.toml", mode = 0o642 }] -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[archive_settings.replacements] -amd64 ="64bit" -386 = "32bit" -arm64 = "ARM64" -darwin = "macOS" -windows = "Windows" +-- hugoreleaser.yaml -- +project: hugo +build_settings: + binary: hugo +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: ${READMEFILE} + target_path: README.md + - source_path: license.txt + target_path: license.txt + - source_path: hugoreleaser.yaml + target_path: subdir/myconfig.yaml + mode: 418 + type: + format: tar.gz + extension: .tar.gz + replacements: + "386": 32bit + amd64: 64bit + arm64: ARM64 + darwin: macOS + windows: Windows +builds: + - path: main/base + build_settings: + env: + - CGO_ENABLED=0 + ldflags: -s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio + flags: + - -buildmode + - exe + os: + - goos: darwin + archs: + - goarch: amd64 + - goarch: arm64 + - goos: linux + archs: + - goarch: amd64 + - goarch: arm + - goos: windows + build_settings: + binary: hugo.exe + archs: + - goarch: amd64 +archives: + - paths: + - builds/**/{darwin,linux}/amd64 + archive_settings: {} + - paths: + - builds/**/windows/* + archive_settings: + type: + format: zip + extension: .zip -[[builds]] -path = "main/base" -[builds.build_settings] -env = ["CGO_ENABLED=0"] -ldflags = "-s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio" -flags = ["-buildmode", "exe"] - -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" - -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm" - -[[builds.os]] -goos = "windows" -[builds.os.build_settings] -binary = "hugo.exe" -[[builds.os.archs]] -goarch = "amd64" - -[[archives]] -paths = ["builds/**/{darwin,linux}/amd64"] -[archives.archive_settings] -[[archives]] -paths = ["builds/**/windows/*"] -[archives.archive_settings] -[archives.archive_settings.type] -format = "zip" -extension = ".zip" -- go.mod -- module foo diff --git a/testscripts/commands/release.txt b/testscripts/commands/release.txt index eb71cf5..3db777c 100644 --- a/testscripts/commands/release.txt +++ b/testscripts/commands/release.txt @@ -45,72 +45,73 @@ linux-amd 19c2308936cdc630dfb1c3620d54fc22dc072dd6d04f8aa0872963c3fb547572 hugo_1.2.0_Windows-64bit.zip 8a49e492c1b787821fe81695617dcaf211ca3c0428094f3a4a4c1401678993a0 hugo_1.2.0_macOS-64bit.tar.gz df51345af47d4122b133055aa8bb6109cc47504026c29634b0a6e77f6aa7ebcf hugo_1.2.0_linux-64bit.tar.gz --- hugoreleaser.toml -- -project = "hugo" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -draft = true -[release_settings.release_notes_settings] -filename = "temp/my-release-notes.md" -[build_settings] -binary = "hugo" -flags = ["-trimpath"] -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -extra_files = [{ source_path = "${READMEFILE}", target_path = "README.md" }, { source_path = "license.txt", target_path = "license.txt" }] -[archive_settings.type] -format = "rename" -extension = ".tar.gz" -[archive_settings.replacements] -amd64 ="64bit" -386 = "32bit" -arm64 = "ARM64" -darwin = "macOS" -windows = "Windows" +-- hugoreleaser.yaml -- +project: hugo +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + draft: true + release_notes_settings: + filename: temp/my-release-notes.md +build_settings: + binary: hugo + flags: + - -trimpath +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: ${READMEFILE} + target_path: README.md + - source_path: license.txt + target_path: license.txt + type: + format: rename + extension: .tar.gz + replacements: + "386": 32bit + amd64: 64bit + arm64: ARM64 + darwin: macOS + windows: Windows +builds: + - path: main/base + build_settings: + env: + - CGO_ENABLED=0 + ldflags: -s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio + flags: + - -buildmode + - exe + os: + - goos: darwin + archs: + - goarch: amd64 + - goarch: arm64 + - goos: linux + archs: + - goarch: amd64 + - goarch: arm + - goos: windows + build_settings: + binary: hugo.exe + archs: + - goarch: amd64 +archives: + - paths: + - builds/**/{darwin,linux}/amd64 + archive_settings: {} + - paths: + - builds/**/windows/* + archive_settings: + type: + format: rename + extension: .zip +releases: + - paths: + - archives/** + path: myrelease -[[builds]] -path = "main/base" -[builds.build_settings] -env = ["CGO_ENABLED=0"] -ldflags = "-s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio" -flags = ["-buildmode", "exe"] - -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" - -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm" - -[[builds.os]] -goos = "windows" -[builds.os.build_settings] -binary = "hugo.exe" -[[builds.os.archs]] -goarch = "amd64" - -[[archives]] -paths = ["builds/**/{darwin,linux}/amd64"] -[archives.archive_settings] -[[archives]] -paths = ["builds/**/windows/*"] -[archives.archive_settings] -[archives.archive_settings.type] -format = "rename" -extension = ".zip" - -[[releases]] -paths = ["archives/**"] -path = "myrelease" -- go.mod -- module foo diff --git a/testscripts/misc/archive_alias_replacements.txt b/testscripts/misc/archive_alias_replacements.txt index bbceb6f..886a757 100644 --- a/testscripts/misc/archive_alias_replacements.txt +++ b/testscripts/misc/archive_alias_replacements.txt @@ -32,60 +32,60 @@ linux-amd64 -- expected/dist/myrelease/checksums.txt -- b5bdae6077aadd1c9fccb2ebf25a5305213e4b460c6827277590c8564a231f4a hugo_1.2.0_linux-64bit.tar.gz b5bdae6077aadd1c9fccb2ebf25a5305213e4b460c6827277590c8564a231f4a hugo_1.2.0_linux-amd64-alias.tar.gz --- hugoreleaser.toml -- -project = "hugo" -archive_alias_replacements = { "linux-64bit" = "linux-amd64-alias" } -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -draft = true -[release_settings.release_notes_settings] -filename = "temp/my-release-notes.md" -[build_settings] -binary = "hugo" -flags = ["-trimpath"] -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "rename" -extension = ".tar.gz" -[archive_settings.replacements] -amd64 ="64bit" -386 = "32bit" -arm64 = "ARM64" -darwin = "macOS" -windows = "Windows" - -[[builds]] -path = "main/base" -[builds.build_settings] -env = ["CGO_ENABLED=0"] -ldflags = "-s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio" -flags = ["-buildmode", "exe"] - - -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm" - - -[[archives]] -paths = ["builds/**/{darwin,linux}/amd64"] -[archives.archive_settings] -[[archives]] -paths = ["builds/**/windows/*"] -[archives.archive_settings] -[archives.archive_settings.type] -format = "rename" -extension = ".zip" - -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugo +archive_alias_replacements: + linux-64bit: linux-amd64-alias +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + draft: true + release_notes_settings: + filename: temp/my-release-notes.md +build_settings: + binary: hugo + flags: + - -trimpath +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: rename + extension: .tar.gz + replacements: + "386": 32bit + amd64: 64bit + arm64: ARM64 + darwin: macOS + windows: Windows +builds: + - path: main/base + build_settings: + env: + - CGO_ENABLED=0 + ldflags: -s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio + flags: + - -buildmode + - exe + os: + - goos: linux + archs: + - goarch: amd64 + - goarch: arm +archives: + - paths: + - builds/**/{darwin,linux}/amd64 + archive_settings: {} + - paths: + - builds/**/windows/* + archive_settings: + type: + format: rename + extension: .zip +releases: + - paths: + - archives/** + path: myrelease -- go.mod -- module foo diff --git a/testscripts/misc/archive_plugin_deb.txt b/testscripts/misc/archive_plugin_deb.txt index 56d7148..fd70ac7 100644 --- a/testscripts/misc/archive_plugin_deb.txt +++ b/testscripts/misc/archive_plugin_deb.txt @@ -8,35 +8,41 @@ hugoreleaser archive -tag v1.2.0 checkfile $WORK/dist/hugo/v1.2.0/archives/linux/amd64/hugo_1.2.0_linux-amd64.deb # Test files --- hugoreleaser.toml -- -project = "hugo" -[build_settings] -binary = "hugo" -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -extra_files = [{ source_path = "README.md", target_path = "README.md" }, { source_path = "license.txt", target_path = "license.txt" }] -[archive_settings.type] -format = "_plugin" -extension = ".deb" -[[builds]] -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[archives.archive_settings] -extra_files = [] -[archives.archive_settings.plugin] -id = "deb" -type = "gorun" -command = "github.com/gohugoio/hugoreleaser-archive-plugins/deb@latest" -[archives.archive_settings.custom_settings] -vendor = "gohugo.io" -homepage = "https://gohugo.io/" -maintainer = "Bjørn Erik Pedersen " -description = "A Fast and Flexible Static Site Generator built with love in GoLang." -license = "Apache-2.0" +-- hugoreleaser.yaml -- +project: hugo +build_settings: + binary: hugo +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: README.md + target_path: README.md + - source_path: license.txt + target_path: license.txt + type: + format: _plugin + extension: .deb +builds: + - os: + - goos: linux + archs: + - goarch: amd64 +archives: + - paths: + - builds/** + archive_settings: + extra_files: [] + plugin: + id: deb + type: gorun + command: github.com/gohugoio/hugoreleaser-archive-plugins/deb@667fb62d3a6c7740d0e3c69e24b4978adbbe889e + custom_settings: + vendor: gohugo.io + homepage: https://gohugo.io/ + maintainer: Bjørn Erik Pedersen + description: A Fast and Flexible Static Site Generator built with love in GoLang. + license: Apache-2.0 + -- go.mod -- module foo diff --git a/testscripts/misc/build_chunks.txt b/testscripts/misc/build_chunks.txt index edfe7c0..91dff01 100644 --- a/testscripts/misc/build_chunks.txt +++ b/testscripts/misc/build_chunks.txt @@ -20,68 +20,61 @@ checkfilecount 9 $WORK/dist/hugo/v1.2.0/builds # Test files --- hugoreleaser.toml -- -project = "hugo" -[build_settings] -binary = "hugo" -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[archive_settings.replacements] -amd64 ="64bit" -386 = "32bit" -arm64 = "ARM64" -darwin = "macOS" -windows = "Windows" -[[builds]] -path = "main/base" -[builds.build_settings] -env = ["CGO_ENABLED=0"] -ldflags = "-s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio" -flags = ["-buildmode", "exe"] +-- hugoreleaser.yaml -- +project: hugo +build_settings: + binary: hugo +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz + replacements: + "386": 32bit + amd64: 64bit + arm64: ARM64 + darwin: macOS + windows: Windows +builds: + - path: main/base + build_settings: + env: + - CGO_ENABLED=0 + ldflags: -s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio + flags: + - -buildmode + - exe + os: + - goos: darwin + archs: + - goarch: amd64 + - goarch: arm64 + - goos: freebsd + archs: + - goarch: amd64 + - goarch: arm64 + - goos: linux + archs: + - goarch: amd64 + - goarch: arm64 + - goarch: arm + - goos: windows + build_settings: + binary: hugo.exe + archs: + - goarch: amd64 + - goarch: arm64 +archives: + - paths: + - builds/**/{darwin,linux}/amd64 + archive_settings: {} + - paths: + - builds/**/windows/* + archive_settings: + type: + format: zip + extension: .zip -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" - -[[builds.os]] -goos = "freebsd" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" - -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" -[[builds.os.archs]] -goarch = "arm" - -[[builds.os]] -goos = "windows" -[builds.os.build_settings] -binary = "hugo.exe" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" -[[archives]] -paths = ["builds/**/{darwin,linux}/amd64"] -[archives.archive_settings] -[[archives]] -paths = ["builds/**/windows/*"] -[archives.archive_settings] -[archives.archive_settings.type] -format = "zip" -extension = ".zip" -- go.mod -- module foo diff --git a/testscripts/misc/build_macos_universal_binary.txt b/testscripts/misc/build_macos_universal_binary.txt index 4432167..2865a7f 100644 --- a/testscripts/misc/build_macos_universal_binary.txt +++ b/testscripts/misc/build_macos_universal_binary.txt @@ -10,36 +10,39 @@ stdout 'Prepared 2 files' stdout 'Uploading.*darwin-universal' # Test files --- hugoreleaser.toml -- -project = "hugo" -[build_settings] -binary = "hugo" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -draft = true -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -extra_files = [{ source_path = "README.md", target_path = "README.md" }, { source_path = "license.txt", target_path = "license.txt" }] -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" +-- hugoreleaser.yaml -- +project: hugo +build_settings: + binary: hugo +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + draft: true +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: README.md + target_path: README.md + - source_path: license.txt + target_path: license.txt + type: + format: tar.gz + extension: .tar.gz +builds: + - path: mac + os: + - goos: darwin + archs: + - goarch: universal +archives: + - paths: + - builds/mac/** +releases: + - paths: + - archives/** + path: myrelease -[[builds]] -path = "mac" - -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "universal" - -[[archives]] -paths = ["builds/mac/**"] - -[[releases]] -paths = ["archives/**"] -path = "myrelease" -- go.mod -- module foo diff --git a/testscripts/misc/envvars.txt b/testscripts/misc/envvars.txt index f92149f..f806b21 100644 --- a/testscripts/misc/envvars.txt +++ b/testscripts/misc/envvars.txt @@ -10,7 +10,7 @@ env NAME3_FROM_ENV=name3os # * Setting flags in hugoreleaser.env # * Having the same env in OS as in hugoreleaser.env (OS will win). # * Do env var replacement in hugoreleaser.toml. -# +# hugoreleaser all @@ -21,31 +21,34 @@ stdout 'First Release!' ! stderr . exists $WORK/dist/hugo/v1.2.3/archives/mybuilds/darwin/amd64/name1_darwin_name2-name3os-amd64.zip --- hugoreleaser.toml -- -project = "hugo" -[archive_settings] -name_template = "${NAME1_FROM_ENV}_{{ .Goos }}_${NAME2_FROM_ENV}-${NAME3_FROM_ENV}-{{ .Goarch }}" -[archive_settings.type] -format = "zip" -extension = ".zip" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -name = "${MYPROJECT_RELEASE_NAME}" -draft = "${MYPROJECT_RELEASE_DRAFT@U}" -[[builds]] -path = "mybuilds" -[builds.build_settings] -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugo +archive_settings: + name_template: ${NAME1_FROM_ENV}_{{ .Goos + }}_${NAME2_FROM_ENV}-${NAME3_FROM_ENV}-{{ .Goarch }} + type: + format: zip + extension: .zip +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + name: ${MYPROJECT_RELEASE_NAME} + draft: "${MYPROJECT_RELEASE_DRAFT@U}" +builds: + - path: mybuilds + build_settings: {} + os: + - goos: darwin + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +releases: + - paths: + - archives/** + path: myrelease -- go.mod -- module foo -- main.go -- diff --git a/testscripts/misc/errors-release-duplicate-archive.txt b/testscripts/misc/errors-release-duplicate-archive.txt index 295a357..15fc48b 100644 --- a/testscripts/misc/errors-release-duplicate-archive.txt +++ b/testscripts/misc/errors-release-duplicate-archive.txt @@ -8,36 +8,37 @@ stderr 'main/darwin/amd64.*main/darwin/arm64.*same archive name "hugoreleaser.tar.gz"' --- hugoreleaser.toml -- -project = "hugoreleaser" -[build_settings] -binary = "hugoreleaser" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "gohugoio" -draft = true -[release_settings.release_notes_settings] -generate = true -[archive_settings] -# Deliberately simple to force duplicates. -name_template = "{{ .Project }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[[builds]] -path = "main" -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" -[[archives]] -paths = ["builds/**"] -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugoreleaser +build_settings: + binary: hugoreleaser +release_settings: + type: github + repository: hugoreleaser + repository_owner: gohugoio + draft: true + release_notes_settings: + generate: true +archive_settings: + name_template: "{{ .Project }}" + type: + format: tar.gz + extension: .tar.gz +builds: + - path: main + os: + - goos: darwin + archs: + - goarch: amd64 + - goarch: arm64 +archives: + - paths: + - builds/** +releases: + - paths: + - archives/** + path: myrelease + -- go.mod -- module foo -- main.go -- diff --git a/testscripts/misc/errors_common.txt b/testscripts/misc/errors_common.txt index 54ce360..e2df2e0 100644 --- a/testscripts/misc/errors_common.txt +++ b/testscripts/misc/errors_common.txt @@ -4,6 +4,6 @@ stderr 'flag -tag is required' ! hugoreleaser build -tag v1.2.0 -stderr 'error opening config file.*hugoreleaser\.toml' +stderr 'error opening config file.*hugoreleaser\.yaml' ! hugoreleaser archive -tag v1.2.0 diff --git a/testscripts/misc/errors_invalid_config.txt b/testscripts/misc/errors_invalid_config.txt index 008aa46..d9851af 100644 --- a/testscripts/misc/errors_invalid_config.txt +++ b/testscripts/misc/errors_invalid_config.txt @@ -1,5 +1,5 @@ ! hugoreleaser build -tag foo stderr 'error decoding config file' --- hugoreleaser.toml -- -foo: bar +-- hugoreleaser.yaml -- +foo = bar diff --git a/testscripts/misc/flag_quiet.txt b/testscripts/misc/flag_quiet.txt index 7ed5d8e..dd34955 100644 --- a/testscripts/misc/flag_quiet.txt +++ b/testscripts/misc/flag_quiet.txt @@ -7,22 +7,24 @@ hugoreleaser archive -tag v1.2.0 -quiet ! stdout . # Test files --- hugoreleaser.toml -- -project = "hugo" -[build_settings] -binary = "hugo" -[[builds]] -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" +-- hugoreleaser.yaml -- +project: hugo +build_settings: + binary: hugo +builds: + - os: + - goos: linux + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz + -- go.mod -- module foo diff --git a/testscripts/misc/flag_try.txt b/testscripts/misc/flag_try.txt index 49a7bd9..141643a 100644 --- a/testscripts/misc/flag_try.txt +++ b/testscripts/misc/flag_try.txt @@ -10,30 +10,32 @@ stdout 'Archive file.*hugo_1.2.0_linux-amd64.tar.gz' hugoreleaser release -tag v1.2.0 -commitish main -try # Test files --- hugoreleaser.toml -- -project = "hugo" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -draft = true -[build_settings] -binary = "hugo" -[[builds]] -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugo +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + draft: true +build_settings: + binary: hugo +builds: + - os: + - goos: linux + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz +releases: + - paths: + - archives/** + path: myrelease -- go.mod -- module foo diff --git a/testscripts/misc/flags_in_env.txt b/testscripts/misc/flags_in_env.txt index dddff46..6a5303e 100644 --- a/testscripts/misc/flags_in_env.txt +++ b/testscripts/misc/flags_in_env.txt @@ -11,33 +11,36 @@ checkfile $WORK/dist/hugoreleaser/v0.9.0/archives/main/darwin/amd64/hugoreleaser # Check that the flags (e.g. -tag) can be used as environment variables in config. # The example below isn't the most relalistic, though :-) --- hugoreleaser.toml -- -project = "hugoreleaser" -[build_settings] -binary = "hugoreleaser" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "gohugoio" -draft = true -[release_settings.release_notes_settings] -generate = true -[archive_settings] -name_template = "{{ .Project }}_{{ `${HUGORELEASER_TAG}` | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[[builds]] -path = "main" -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugoreleaser +build_settings: + binary: hugoreleaser +release_settings: + type: github + repository: hugoreleaser + repository_owner: gohugoio + draft: true + release_notes_settings: + generate: true +archive_settings: + name_template: "{{ .Project }}_{{ `${HUGORELEASER_TAG}` | trimPrefix `v` }}_{{ + .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz +builds: + - path: main + os: + - goos: darwin + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +releases: + - paths: + - archives/** + path: myrelease -- go.mod -- module foo -- main.go -- diff --git a/testscripts/misc/releasenotes-custom-template.txt b/testscripts/misc/releasenotes-custom-template.txt index 42c32fc..d04fffc 100644 --- a/testscripts/misc/releasenotes-custom-template.txt +++ b/testscripts/misc/releasenotes-custom-template.txt @@ -13,34 +13,37 @@ cmp $WORK/dist/hugoreleaser/v0.51.0/releases/myrelease/release-notes.md $WORK/ex {{ range .ChangeGroups }}{{ range .Changes }}Subject: {{ .Subject }}, Hash: {{ .Hash }}|{{ end }}{{ end }} -- expected/release-notes.md -- Subject: Shuffle chunked builds, Hash: 515615e|Subject: Throw an error on duplicate archive names in a release, Hash: 8b4ede0|Subject: Fix failing tests, Hash: 130ca16| --- hugoreleaser.toml -- -project = "hugoreleaser" -[build_settings] -binary = "hugoreleaser" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "gohugoio" -draft = true -[release_settings.release_notes_settings] -generate = true -template_filename = "mytemplates/custom.txt" -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[[builds]] -path = "main" -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugoreleaser +build_settings: + binary: hugoreleaser +release_settings: + type: github + repository: hugoreleaser + repository_owner: gohugoio + draft: true + release_notes_settings: + generate: true + template_filename: mytemplates/custom.txt +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz +builds: + - path: main + os: + - goos: darwin + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +releases: + - paths: + - archives/** + path: myrelease + -- go.mod -- module foo -- main.go -- diff --git a/testscripts/misc/releasenotes-short.txt b/testscripts/misc/releasenotes-short.txt index b163447..58dd565 100644 --- a/testscripts/misc/releasenotes-short.txt +++ b/testscripts/misc/releasenotes-short.txt @@ -16,38 +16,41 @@ cmp $WORK/dist/hugoreleaser/v0.53.2/releases/myrelease/release-notes.md $WORK/ex * testing: Cosmetic change3 to test patch releases 0ae1602 #30 --- hugoreleaser.toml -- -project = "hugoreleaser" -[build_settings] -binary = "hugoreleaser" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "gohugoio" -draft = true -[release_settings.release_notes_settings] -generate = true -short_threshold = 10 -short_title = "Short release" -groups = [ -{ regexp = "change4", ignore = true } -] -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[[builds]] -path = "main" -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugoreleaser +build_settings: + binary: hugoreleaser +release_settings: + type: github + repository: hugoreleaser + repository_owner: gohugoio + draft: true + release_notes_settings: + generate: true + short_threshold: 10 + short_title: Short release + groups: + - regexp: change4 + ignore: true +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz +builds: + - path: main + os: + - goos: darwin + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +releases: + - paths: + - archives/** + path: myrelease + -- go.mod -- module foo -- main.go -- diff --git a/testscripts/misc/releasenotes.txt b/testscripts/misc/releasenotes.txt index cdb8a8a..dee036e 100644 --- a/testscripts/misc/releasenotes.txt +++ b/testscripts/misc/releasenotes.txt @@ -23,38 +23,43 @@ cmp $WORK/dist/hugoreleaser/v0.51.0/releases/myrelease/release-notes.md $WORK/ex * Shuffle chunked builds 515615e --- hugoreleaser.toml -- -project = "hugoreleaser" -[build_settings] -binary = "hugoreleaser" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "gohugoio" -draft = true -[release_settings.release_notes_settings] -generate = true -groups = [ - { title = "First", regexp = "error" }, - { title = "Second", regexp = "failing" }, - { title = "Third", regexp = "chunked" }, -] -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" -[[builds]] -path = "main" -[[builds.os]] -goos = "darwin" -[[builds.os.archs]] -goarch = "amd64" -[[archives]] -paths = ["builds/**"] -[[releases]] -paths = ["archives/**"] -path = "myrelease" +-- hugoreleaser.yaml -- +project: hugoreleaser +build_settings: + binary: hugoreleaser +release_settings: + type: github + repository: hugoreleaser + repository_owner: gohugoio + draft: true + release_notes_settings: + generate: true + groups: + - title: First + regexp: error + - title: Second + regexp: failing + - title: Third + regexp: chunked +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + type: + format: tar.gz + extension: .tar.gz +builds: + - path: main + os: + - goos: darwin + archs: + - goarch: amd64 +archives: + - paths: + - builds/** +releases: + - paths: + - archives/** + path: myrelease + -- go.mod -- module foo -- main.go -- diff --git a/testscripts/misc/segments.txt b/testscripts/misc/segments.txt index 0eb7c2d..ecc4d79 100644 --- a/testscripts/misc/segments.txt +++ b/testscripts/misc/segments.txt @@ -21,64 +21,56 @@ hugoreleaser release -paths releases/bsd stdout 'Prepared 3 files' # 2 archives + checksums.txt. # Test files --- hugoreleaser.toml -- -project = "hugo" -[build_settings] -binary = "hugo" -[release_settings] -type = "github" -repository = "hugoreleaser" -repository_owner = "bep" -draft = true -[archive_settings] -name_template = "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" -extra_files = [{ source_path = "README.md", target_path = "README.md" }, { source_path = "license.txt", target_path = "license.txt" }] -[archive_settings.type] -format = "tar.gz" -extension = ".tar.gz" +-- hugoreleaser.yaml -- +project: hugo +build_settings: + binary: hugo +release_settings: + type: github + repository: hugoreleaser + repository_owner: bep + draft: true +archive_settings: + name_template: "{{ .Project }}_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + extra_files: + - source_path: README.md + target_path: README.md + - source_path: license.txt + target_path: license.txt + type: + format: tar.gz + extension: .tar.gz +builds: + - path: unix + os: + - goos: freebsd + archs: + - goarch: amd64 + - goarch: arm64 + - goarch: arm + - goarch: "386" + - goos: linux + archs: + - goarch: amd64 + - goarch: arm64 + - goarch: arm + - path: win + os: + - goos: windows + archs: + - goarch: amd64 + - goarch: arm64 +archives: + - paths: + - builds/unix/** +releases: + - paths: + - archives/**/freebsd/arm* + path: bsd + - paths: + - archives/win/** + path: win -[[builds]] -path = "unix" - -[[builds.os]] -goos = "freebsd" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" -[[builds.os.archs]] -goarch = "arm" -[[builds.os.archs]] -goarch = "386" - -[[builds.os]] -goos = "linux" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" -[[builds.os.archs]] -goarch = "arm" - -[[builds]] -path = "win" - -[[builds.os]] -goos = "windows" -[[builds.os.archs]] -goarch = "amd64" -[[builds.os.archs]] -goarch = "arm64" - -[[archives]] -paths = ["builds/unix/**"] - -[[releases]] -paths = ["archives/**/freebsd/arm*"] -path = "bsd" -[[releases]] -paths = ["archives/win/**"] -path = "win" -- go.mod -- module foo diff --git a/watch_testscripts.sh b/watch_testscripts.sh index f6676ba..49656ed 100755 --- a/watch_testscripts.sh +++ b/watch_testscripts.sh @@ -1,5 +1,7 @@ #!/bin/bash +trap exit SIGINT + # I use "run tests on save" in my editor. # Unfortantly, changes to text files does not trigger this. Hence this workaround. -while true; do find testscripts internal -type f -name "*.txt" -o -type f -name "*.toml" | entr -pd touch main_test.go; done \ No newline at end of file +while true; do find . -type f -name "*.txt" -o -type f -name "*.yaml" | entr -pd touch main_test.go; done \ No newline at end of file