Skip to content

Commit 89bd025

Browse files
committed
Build without the deploy feature by default
Build tags setup changed to: * !nodeploy => withdeploy * nodeploy => !withdeploy Also move the deploy feature out into its own release archives. See #12994 for the primary motivation for this change. But this also greatly reduces the number of dependencies in Hugo when you don't need this feature and cuts the binary size greatly. Fixes #12994
1 parent 62567d3 commit 89bd025

File tree

16 files changed

+78
-42
lines changed

16 files changed

+78
-42
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,17 @@ jobs:
112112
sass --version;
113113
mage -v check;
114114
env:
115-
HUGO_BUILD_TAGS: extended
115+
HUGO_BUILD_TAGS: extended,withdeploy
116116
- if: matrix.os == 'windows-latest'
117117
# See issue #11052. We limit the build to regular test (no -race flag) on Windows for now.
118118
name: Test
119119
run: |
120120
mage -v test;
121121
env:
122-
HUGO_BUILD_TAGS: extended
122+
HUGO_BUILD_TAGS: extended,withdeploy
123123
- name: Build tags
124124
run: |
125-
go install -tags extended,nodeploy
125+
go install -tags extended
126126
- if: matrix.os == 'ubuntu-latest'
127127
name: Build for dragonfly
128128
run: |

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11

22
*.test
3-
imports.*
3+
imports.*
4+
dist/
5+
public/

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ COPY --from=xx / /
2121
ARG TARGETPLATFORM
2222
RUN xx-apk add musl-dev gcc g++
2323

24-
# Optionally set HUGO_BUILD_TAGS to "none" or "nodeploy" when building like so:
25-
# docker build --build-arg HUGO_BUILD_TAGS=nodeploy .
24+
# Optionally set HUGO_BUILD_TAGS to "none" or "withdeploy" when building like so:
25+
# docker build --build-arg HUGO_BUILD_TAGS=withdeploy .
2626
#
2727
# We build the extended version by default.
2828
ARG HUGO_BUILD_TAGS="extended"

commands/deploy.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !nodeploy
15-
// +build !nodeploy
16-
17-
// Copyright 2024 The Hugo Authors. All rights reserved.
18-
//
19-
// Licensed under the Apache License, Version 2.0 (the "License");
20-
// you may not use this file except in compliance with the License.
21-
// You may obtain a copy of the License at
22-
// http://www.apache.org/licenses/LICENSE-2.0
23-
//
24-
// Unless required by applicable law or agreed to in writing, software
25-
// distributed under the License is distributed on an "AS IS" BASIS,
26-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27-
// See the License for the specific language governing permissions and
28-
// limitations under the License.
14+
//go:build withdeploy
15+
// +build withdeploy
2916

3017
package commands
3118

commands/deploy_off.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build nodeploy
15-
// +build nodeploy
14+
//go:build !withdeploy
15+
// +build !withdeploy
1616

1717
// Copyright 2024 The Hugo Authors. All rights reserved.
1818
//
@@ -31,6 +31,7 @@ package commands
3131

3232
import (
3333
"context"
34+
"errors"
3435

3536
"github.com/bep/simplecobra"
3637
"github.com/spf13/cobra"
@@ -40,7 +41,7 @@ func newDeployCommand() simplecobra.Commander {
4041
return &simpleCommand{
4142
name: "deploy",
4243
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
43-
return nil
44+
return errors.New("deploy not supported in this version of Hugo; install a release with 'withdeploy' in the archive filename or build yourself with the 'withdeploy' build tag. Also see https://github.com/gohugoio/hugo/pull/12995")
4445
},
4546
withc: func(cmd *cobra.Command, r *rootCommand) {
4647
cmd.Hidden = true

deploy/cloudfront.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !nodeploy
15-
// +build !nodeploy
14+
//go:build withdeploy
15+
// +build withdeploy
1616

1717
package deploy
1818

deploy/deploy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !nodeploy
15-
// +build !nodeploy
14+
//go:build withdeploy
15+
// +build withdeploy
1616

1717
package deploy
1818

deploy/deploy_azure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !solaris && !nodeploy
15-
// +build !solaris,!nodeploy
14+
//go:build !solaris && withdeploy
15+
// +build !solaris,withdeploy
1616

1717
package deploy
1818

deploy/deploy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !nodeploy
15-
// +build !nodeploy
14+
//go:build withdeploy
15+
// +build withdeploy
1616

1717
package deploy
1818

deploy/deployconfig/deployConfig_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build !nodeploy
15-
// +build !nodeploy
14+
//go:build withdeploy
15+
// +build withdeploy
1616

1717
package deployconfig
1818

0 commit comments

Comments
 (0)