Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump goreleaser version and optimize get-version #2127

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ builds:
ldflags:
- -w -X github.com/tektoncd/cli/pkg/cmd/version.clientVersion={{.Version}}
archives:
- name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
arm64: aarch64
- name_template: >-
{{- .Binary }}_
{{- .Version }}_
{{- title .Os }}_
piyush-garg marked this conversation as resolved.
Show resolved Hide resolved
{{- if eq .Arch "amd64" }}x86_64
piyush-garg marked this conversation as resolved.
Show resolved Hide resolved
{{- else if eq .Arch "386" }}i386
{{- else if eq .Arch "arm64" }}aarch64
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip
Expand All @@ -41,11 +41,10 @@ changelog:
- Merge pull request
- Merge branch
release:
prerelease: true
prerelease: "true"
brews:
-
name: tektoncd-cli
tap:
- name: tektoncd-cli
repository:
owner: tektoncd
name: homebrew-tools
folder: Formula
Expand All @@ -62,7 +61,15 @@ brews:
(zsh_completion/"_tkn").write output
prefix.install_metafiles
nfpms:
- file_name_template: "tektoncd-cli-{{.Version}}_{{.Os}}-{{.Arch}}"
- file_name_template: >-
tektoncd-cli-
{{- .Version }}_
{{- title .Os }}-
piyush-garg marked this conversation as resolved.
Show resolved Hide resolved
{{- if eq .Arch "amd64" }}64bit
{{- else if eq .Arch "386" }}32bit
{{- else if eq .Arch "arm" }}ARM
{{- else if eq .Arch "arm64" }}ARM64
piyush-garg marked this conversation as resolved.
Show resolved Hide resolved
{{- else }}{{ .Arch }}{{ end }}
homepage: https://github.com/tektoncd/cli/
description: A command line interface for interacting with Tekton
maintainer: Tekton Developers <[email protected]>
Expand All @@ -72,15 +79,6 @@ nfpms:
- deb
- rpm
bindir: /usr/bin
replacements:
amd64: 64bit
386: 32bit
arm: ARM
arm64: ARM64
darwin: macOS
linux: Linux
windows: Windows

universal_binaries:
- replace: true
name_template: 'tkn'
16 changes: 6 additions & 10 deletions tekton/get-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ spec:
- name: package
description: base package where the source code lies
steps:
- name: pull
image: goreleaser/goreleaser
- name: pull-get-versions
image: alpine/git:v2.40.1
workingDir: $(workspaces.source.path)
script: |
git config --global --add safe.directory $(workspaces.source.path)
git status && git fetch -p --all
- name: get-versions
# because it has git
image: goreleaser/goreleaser
workingDir: $(workspaces.source.path)
script: |
echo -n $(git tag --points-at HEAD) > /tekton/results/version
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\1/') > /tekton/results/major
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\2/') > /tekton/results/minor
echo -n $(git tag --points-at HEAD) > $(results.version.path)
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\1/') > $(results.major.path)
echo -n $(git tag --points-at HEAD | sed 's/^v\([^\.]*\)\.\([^\.]*\).*/\2/') > $(results.minor.path)
results:
- name: version
- name: major
Expand Down
2 changes: 1 addition & 1 deletion tekton/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
- name: github-token-secret-key
value: $(params.github-token-secret-key)
- name: image
value: goreleaser/goreleaser:v1.11.5
value: goreleaser/goreleaser:v1.20.0
workspaces:
- name: source
workspace: shared-workspace
9 changes: 5 additions & 4 deletions tekton/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ kubectl create namespace ${TARGET_NAMESPACE} 2>/dev/null || true

for task in ${CATALOG_TASKS};do
if [ ${task} == "lint" ]; then
kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/golangci-${task}/0.2/golangci-${task}.yaml
tkn -n ${TARGET_NAMESPACE} hub install task golangci-lint
else
kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/golang-${task}/0.2/golang-${task}.yaml
tkn -n ${TARGET_NAMESPACE} hub install task golang-${task}
fi
done

kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.6/git-clone.yaml
kubectl -n ${TARGET_NAMESPACE} apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/goreleaser/0.2/goreleaser.yaml
tkn -n ${TARGET_NAMESPACE} install task git-clone
tkn -n ${TARGET_NAMESPACE} install task goreleaser

kubectl -n ${TARGET_NAMESPACE} apply -f ./tekton/get-version.yaml
kubectl -n ${TARGET_NAMESPACE} apply -f ./tekton/publish.yaml

Expand Down
Loading