Skip to content

Commit

Permalink
Add linux/arm64 extended to release setup
Browse files Browse the repository at this point in the history
Fixes #8257
  • Loading branch information
bep committed Aug 28, 2022
1 parent c983484 commit 45e1084
Show file tree
Hide file tree
Showing 13 changed files with 438 additions and 1,183 deletions.
127 changes: 95 additions & 32 deletions .circleci/config.yml
@@ -1,51 +1,114 @@
parameters:

# v2: 11m.
defaults: &defaults
resource_class: large
docker:
- image: bepsays/ci-goreleaser:1.21900.20000
environment:
CGO_ENABLED: "0"

- image: bepsays/ci-hugoreleaser:1.21900.20000
environment: &buildenv
GOMODCACHE: /root/project/gomodcache
version: 2
jobs:
build:
<<: *defaults
prepare_release:
<<: *defaults
environment: &buildenv
GOMODCACHE: /root/project/gomodcache
steps:
- checkout:
- &remote-docker
setup_remote_docker:
version: 20.10.14
- checkout:
path: hugo
- &git-config
run:
command: |
git config --global user.email "bjorn.erik.pedersen+hugoreleaser@gmail.com"
git config --global user.name "hugoreleaser"
- run:
command: |
git clone git@github.com:gohugoio/hugoDocs.git
cd hugo
go mod download
sleep 5
go mod verify
- persist_to_workspace:
root: .
paths: .
release:
<<: *defaults
command: |
cd hugo
go mod download
go run -tags release main.go release --step 1
- save_cache:
key: git-sha-{{ .Revision }}
paths:
- hugo
- gomodcache
build_container1:
<<: [*defaults]
environment:
<<: [*buildenv]
steps:
- attach_workspace:
at: /root/project
- &restore-cache
restore_cache:
key: git-sha-{{ .Revision }}
- run:
command: |
cd hugo
git config --global user.email "bjorn.erik.pedersen+hugoreleaser@gmail.com"
git config --global user.name "hugoreleaser"
go run -tags release main.go release -r ${CIRCLE_BRANCH}
no_output_timeout: 20m
command: |
mkdir -p /tmp/files/dist1
cd hugo
hugoreleaser build -paths "builds/container1/**" -workers 3 -dist /tmp/files/dist1 -chunks $CIRCLE_NODE_TOTAL -chunk-index $CIRCLE_NODE_INDEX
- &persist-workspace
persist_to_workspace:
root: /tmp/files
paths:
- dist1
- dist2
parallelism: 7
build_container2:
<<: [*defaults]
environment:
<<: [*buildenv]
docker:
- image: bepsays/ci-hugoreleaser-linux-arm64:1.21900.20000
steps:
- *restore-cache
- &attach-workspace
attach_workspace:
at: /tmp/workspace
- run:
command: |
mkdir -p /tmp/files/dist2
cd hugo
hugoreleaser build -paths "builds/container2/**" -workers 1 -dist /tmp/files/dist2
- *persist-workspace
archive_and_release:
<<: [*defaults]
environment:
<<: [*buildenv]
steps:
- *restore-cache
- *attach-workspace
- *git-config
- run:
command: |
cp -a /tmp/workspace/dist1/. ./hugo/dist
cp -a /tmp/workspace/dist2/. ./hugo/dist
- run:
command: |
cd hugo
hugoreleaser archive
hugoreleaser release
go run -tags release main.go release --step 2
workflows:
version: 2
release:
jobs:
- build:
- prepare_release:
filters:
branches:
only: /release-.*/
- hold:
type: approval
- build_container1:
requires:
- prepare_release
- build_container2:
requires:
- build
- release:
- prepare_release
- archive_and_release:
context: org-global
requires:
- hold
- build_container1
- build_container2



23 changes: 11 additions & 12 deletions commands/release.go
Expand Up @@ -17,8 +17,6 @@
package commands

import (
"errors"

"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/releaser"
"github.com/spf13/cobra"
Expand All @@ -29,10 +27,9 @@ var _ cmder = (*releaseCommandeer)(nil)
type releaseCommandeer struct {
cmd *cobra.Command

version string

skipPublish bool
try bool
step int
skipPush bool
try bool
}

func createReleaser() cmder {
Expand All @@ -50,9 +47,9 @@ func createReleaser() cmder {
return r.release()
}

r.cmd.PersistentFlags().StringVarP(&r.version, "rel", "r", "", "new release version, i.e. 0.25.1")
r.cmd.PersistentFlags().BoolVarP(&r.skipPublish, "skip-publish", "", false, "skip all publishing pipes of the release")
r.cmd.PersistentFlags().BoolVarP(&r.try, "try", "", false, "simulate a release, i.e. no changes")
r.cmd.PersistentFlags().BoolVarP(&r.skipPush, "skip-push", "", false, "skip pushing to remote")
r.cmd.PersistentFlags().BoolVarP(&r.try, "try", "", false, "no changes")
r.cmd.PersistentFlags().IntVarP(&r.step, "step", "", 0, "step to run (1: set new version 2: prepare next dev version)")

return r
}
Expand All @@ -65,8 +62,10 @@ func (c *releaseCommandeer) flagsToConfig(cfg config.Provider) {
}

func (r *releaseCommandeer) release() error {
if r.version == "" {
return errors.New("must set the --rel flag to the relevant version number")
rel, err := releaser.New(r.skipPush, r.try, r.step)
if err != nil {
return err
}
return releaser.New(r.version, r.skipPublish, r.try).Run()

return rel.Run()
}

0 comments on commit 45e1084

Please sign in to comment.