fix: reduce disk usage during release

Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
This commit is contained in:
Michael 2023-08-04 12:26:05 +02:00 committed by GitHub
parent f518676238
commit 1ddb0afb24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 8 deletions

View file

@ -1,8 +1,12 @@
project_name: traefik project_name: traefik
dist: "./dist/[[ .GOOS ]]"
[[ if eq .GOOS "linux" ]]
before: before:
hooks: hooks:
- go generate - go generate
[[ end ]]
builds: builds:
- binary: traefik - binary: traefik
@ -15,11 +19,7 @@ builds:
flags: flags:
- -trimpath - -trimpath
goos: goos:
- linux - "[[ .GOOS ]]"
- darwin
- windows
- freebsd
- openbsd
goarch: goarch:
- amd64 - amd64
- '386' - '386'

View file

@ -62,7 +62,7 @@ blocks:
- name: traefik - name: traefik
env_vars: env_vars:
- name: GH_VERSION - name: GH_VERSION
value: 1.12.1 value: 2.32.1
- name: CODENAME - name: CODENAME
value: "saintmarcelin" value: "saintmarcelin"
- name: IN_DOCKER - name: IN_DOCKER
@ -79,5 +79,5 @@ blocks:
- name: Release - name: Release
commands: commands:
- make release-packages - make release-packages
- gh release create ${SEMAPHORE_GIT_TAG_NAME} ./dist/traefik*.* --repo traefik/traefik --title ${SEMAPHORE_GIT_TAG_NAME} --notes ${SEMAPHORE_GIT_TAG_NAME} - gh release create ${SEMAPHORE_GIT_TAG_NAME} ./dist/**/traefik*.{zip,tar.gz} ./dist/traefik*.{tar.gz,txt} --repo traefik/traefik --title ${SEMAPHORE_GIT_TAG_NAME} --notes ${SEMAPHORE_GIT_TAG_NAME}
- ./script/deploy.sh - ./script/deploy.sh

View file

@ -189,7 +189,13 @@ generate-genconf:
.PHONY: release-packages .PHONY: release-packages
release-packages: generate-webui build-dev-image release-packages: generate-webui build-dev-image
rm -rf dist rm -rf dist
$(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) goreleaser release --skip-publish -p 2 --timeout="90m" @- $(foreach os, linux darwin windows freebsd openbsd, \
$(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) goreleaser release --skip-publish -p 2 --timeout="90m" --config $(shell go run ./internal/release $(os)); \
$(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) go clean -cache; \
)
$(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) cat dist/**/*_checksums.txt >> dist/traefik_${VERSION}_checksums.txt
$(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) rm dist/**/*_checksums.txt
$(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) tar cfz dist/traefik-${VERSION}.src.tar.gz \ $(if $(IN_DOCKER),$(DOCKER_RUN_TRAEFIK_NOTTY)) tar cfz dist/traefik-${VERSION}.src.tar.gz \
--exclude-vcs \ --exclude-vcs \
--exclude .idea \ --exclude .idea \

View file

@ -0,0 +1,41 @@
package main
import (
"fmt"
"log"
"os"
"path"
"strings"
"text/template"
)
func main() {
if len(os.Args) < 2 {
log.Fatal("GOOS should be provided as a CLI argument")
}
goos := strings.TrimSpace(os.Args[1])
if goos == "" {
log.Fatal("GOOS should be provided as a CLI argument")
}
tmpl := template.Must(
template.New(".goreleaser.yml.tmpl").
Delims("[[", "]]").
ParseFiles("./.goreleaser.yml.tmpl"),
)
outputPath := path.Join(os.TempDir(), fmt.Sprintf(".goreleaser_%s.yml", goos))
output, err := os.Create(outputPath)
if err != nil {
log.Fatal(err)
}
err = tmpl.Execute(output, map[string]string{"GOOS": goos})
if err != nil {
log.Fatal(err)
}
fmt.Print(outputPath)
}