From c6de30ac3e41fda0d23b747af4806f3037a8377c Mon Sep 17 00:00:00 2001 From: qa-swaneet-sahoo Date: Wed, 27 Apr 2022 01:35:47 +0200 Subject: [PATCH 01/35] Work in progress. --- template.goreleaser.yaml | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/template.goreleaser.yaml b/template.goreleaser.yaml index 72bab779..93ab6dc1 100644 --- a/template.goreleaser.yaml +++ b/template.goreleaser.yaml @@ -85,6 +85,74 @@ nfpms: - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' + +brews: + - name: protocurl + + # GitHub/GitLab repository to push the formula to + tap: + owner: GollyTicker + name: homebrew-tap + + # Optionally a branch can be provided. + # Defaults to the default repository branch. + branch: main + # todo. use current branch here. + + # Template for the url which is determined by the given Token (github, gitlab or gitea) + # + # Default depends on the client. + url_template: "http://github.mycompany.com/foo/bar/releases/{{ .Tag }}/{{ .ArtifactName }}" + + # Allows you to set a custom download strategy. Note that you'll need + # to implement the strategy and add it to your tap repository. + # Example: https://docs.brew.sh/Formula-Cookbook#specifying-the-download-strategy-explicitly + # Default is empty. + download_strategy: CurlDownloadStrategy + + # Allows you to add a custom require_relative at the top of the formula template + # Default is empty + custom_require: custom_download_strategy + + # Git author used to commit to the repository. + # Defaults are shown. + commit_author: + name: goreleaserbot + email: goreleaser@carlosbecker.com + + # The project name and current git tag are used in the format string. + commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" + + # Folder inside the repository to put the formula. + # Default is the root folder. + folder: Formula + + # Caveats for the user of your binary. + # Default is empty. + caveats: "How to use this binary" + + # Your app's homepage. + # Default is empty. + homepage: "https://example.com/" + + # Template of your app's description. + # Default is empty. + description: "Software to create fast and easy drum rolls." + + license: MIT + + # Setting this will prevent goreleaser to actually try to commit the updated + # formula - instead, the formula file will be stored on the dist folder only, + # leaving the responsibility of publishing it to the user. + # If set to auto, the release will not be uploaded to the homebrew tap + # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 + # Default is false. + skip_upload: false + # todo. this should be set to auto + + dependencies: + - name: curl + release: # If set to auto, will mark the release as not ready for production # in case there is an indicator for this in the tag e.g. v1.0.0-rc1 From 93851df07ebb8fc2162cf92023332a8be700ecc1 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 17 Oct 2023 18:01:09 +0200 Subject: [PATCH 02/35] chore: add iml files to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 42cf6f3a..9e098f14 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ node_modules/ # IntelliJ .idea +*.iml # GoReleaser dist/ From 9d256a7d299708907d70a68dc3368cf3d9cf7b8e Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Wed, 18 Oct 2023 10:20:10 +0200 Subject: [PATCH 03/35] feat: first try of goreleaser brew tap --- .gitignore | 3 +- release/completions.sh | 9 +++++ template.goreleaser.yaml | 79 ++++++++++------------------------------ 3 files changed, 30 insertions(+), 61 deletions(-) create mode 100755 release/completions.sh diff --git a/.gitignore b/.gitignore index 9e098f14..851a762a 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ node_modules/ *.iml # GoReleaser -dist/ +/dist/ +/completions/ # template output .goreleaser.yaml diff --git a/release/completions.sh b/release/completions.sh new file mode 100755 index 00000000..bf718f98 --- /dev/null +++ b/release/completions.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# https://carlosbecker.com/posts/golang-completions-cobra/ +set -e + +rm -rf completions +mkdir completions +for sh in bash zsh fish; do + go run src/protocurl.go completion "$sh" >"completions/protocurl.$sh" +done diff --git a/template.goreleaser.yaml b/template.goreleaser.yaml index 93ab6dc1..27805092 100644 --- a/template.goreleaser.yaml +++ b/template.goreleaser.yaml @@ -3,6 +3,10 @@ # This file is a template and expressions such as __PROTOC_VERSION__ are replaced # with environment variables such as $PROTOC_VERSION before usage. +before: + hooks: + - ./release/completions.sh + # https://goreleaser.com/customization/build/ builds: - binary: bin/protocurl @@ -27,6 +31,7 @@ archives: # binary is added implicitly - README.md - LICENSE.md + - completions/* # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/bin' dst: 'protocurl-internal/bin' @@ -85,80 +90,34 @@ nfpms: - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' - brews: - - name: protocurl - + - homepage: https://gitlab.com/{{ .Env.PROJECT_PATH }} + description: >- + protoCURL is cURL for Protobuf: + The command-line tool for interacting with Protobuf over + HTTP REST endpoints using human-readable text formats. + license: MIT + url_template: "https://github.com/qaware/protocurl/releases/{{ .Tag }}/{{ .ArtifactName }}" + skip_upload: false # TODO: When finished set this to auto. For testing rc's are also deployed # GitHub/GitLab repository to push the formula to tap: - owner: GollyTicker + owner: qaware name: homebrew-tap - - # Optionally a branch can be provided. - # Defaults to the default repository branch. branch: main - # todo. use current branch here. - - # Template for the url which is determined by the given Token (github, gitlab or gitea) - # - # Default depends on the client. - url_template: "http://github.mycompany.com/foo/bar/releases/{{ .Tag }}/{{ .ArtifactName }}" - - # Allows you to set a custom download strategy. Note that you'll need - # to implement the strategy and add it to your tap repository. - # Example: https://docs.brew.sh/Formula-Cookbook#specifying-the-download-strategy-explicitly - # Default is empty. - download_strategy: CurlDownloadStrategy - - # Allows you to add a custom require_relative at the top of the formula template - # Default is empty - custom_require: custom_download_strategy - - # Git author used to commit to the repository. - # Defaults are shown. - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - - # The project name and current git tag are used in the format string. - commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" - - # Folder inside the repository to put the formula. - # Default is the root folder. folder: Formula - - # Caveats for the user of your binary. - # Default is empty. - caveats: "How to use this binary" - - # Your app's homepage. - # Default is empty. - homepage: "https://example.com/" - - # Template of your app's description. - # Default is empty. - description: "Software to create fast and easy drum rolls." - - license: MIT - - # Setting this will prevent goreleaser to actually try to commit the updated - # formula - instead, the formula file will be stored on the dist folder only, - # leaving the responsibility of publishing it to the user. - # If set to auto, the release will not be uploaded to the homebrew tap - # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 - # Default is false. - skip_upload: false - # todo. this should be set to auto - dependencies: - name: curl + install: |- + bin.install "{{ .ProjectName }}" + bash_completion.install "completions/{{ .ProjectName }}.bash" => "{{ .ProjectName }}" + zsh_completion.install "completions/{{ .ProjectName }}.zsh" => "_{{ .ProjectName }}" + fish_completion.install "completions/{{ .ProjectName }}.fish" release: # If set to auto, will mark the release as not ready for production # in case there is an indicator for this in the tag e.g. v1.0.0-rc1 prerelease: auto - checksum: name_template: 'checksums.txt' From 735aa5b90a59279fb26de38b299fe258567296cf Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Fri, 20 Oct 2023 18:36:41 +0200 Subject: [PATCH 04/35] feat: adapt config so it should work --- template.goreleaser.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/template.goreleaser.yaml b/template.goreleaser.yaml index 27805092..97c2242c 100644 --- a/template.goreleaser.yaml +++ b/template.goreleaser.yaml @@ -100,10 +100,11 @@ brews: url_template: "https://github.com/qaware/protocurl/releases/{{ .Tag }}/{{ .ArtifactName }}" skip_upload: false # TODO: When finished set this to auto. For testing rc's are also deployed # GitHub/GitLab repository to push the formula to - tap: + repository: owner: qaware name: homebrew-tap branch: main + token: "{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}" # TODO: Setup token folder: Formula dependencies: - name: curl From 49494738649f4978df8fdf7492f8a60f242b28ff Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 11:43:09 +0200 Subject: [PATCH 05/35] feat: Almost final step --- .gitignore | 2 -- template.goreleaser.yaml => .goreleaser.yaml | 16 +++++++--------- RELEASE.md | 2 +- release/30-build-go-archive.sh | 3 --- 4 files changed, 8 insertions(+), 15 deletions(-) rename template.goreleaser.yaml => .goreleaser.yaml (84%) diff --git a/.gitignore b/.gitignore index 851a762a..2baf1987 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,3 @@ node_modules/ # GoReleaser /dist/ /completions/ -# template output -.goreleaser.yaml diff --git a/template.goreleaser.yaml b/.goreleaser.yaml similarity index 84% rename from template.goreleaser.yaml rename to .goreleaser.yaml index 97c2242c..0edbdc56 100644 --- a/template.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,8 +1,5 @@ # Documentation at https://goreleaser.com -# This file is a template and expressions such as __PROTOC_VERSION__ are replaced -# with environment variables such as $PROTOC_VERSION before usage. - before: hooks: - ./release/completions.sh @@ -33,10 +30,10 @@ archives: - LICENSE.md - completions/* # copy protoc binaries and their .proto files previously downloaded - - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/bin' + - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/bin' dst: 'protocurl-internal/bin' strip_parent: true # avoids, that protoc is copied into protocurl-internal/bin/release/tmp/.../bin - - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/include/google/protobuf' + - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: 'protocurl-internal/include/google/protobuf' strip_parent: true @@ -85,13 +82,14 @@ nfpms: - src: LICENSE.md dst: /opt/protocurl/LICENSE.md # copy protoc binaries and their .proto files previously downloaded - - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/bin' + - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/bin' dst: '/opt/protocurl/protocurl-internal/bin' - - src: 'release/tmp/protoc-__PROTO_VERSION__-{{ .Os }}-{{ .Arch }}/include/google/protobuf' + - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' brews: - - homepage: https://gitlab.com/{{ .Env.PROJECT_PATH }} + - name: protocurl@{{ .Major }}.{{ .Minor }}.{{ .Patch }} + homepage: https://gitlab.com/{{ .Env.PROJECT_PATH }} description: >- protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over @@ -104,7 +102,7 @@ brews: owner: qaware name: homebrew-tap branch: main - token: "{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}" # TODO: Setup token + token: "{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}" folder: Formula dependencies: - name: curl diff --git a/RELEASE.md b/RELEASE.md index 0de57ce7..cf9f9d79 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,7 +3,7 @@ We use [GoReleaser](https://goreleaser.com/) to create static binaries and Docker Buildx to build multi-architecture images. -The relevant configuration for the release process is in [template.goreleaser.yml](template.goreleaser.yaml) +The relevant configuration for the release process is in [.goreleaser.yml](.goreleaser.yaml) and [release/source.sh](release/source.sh). It **automatically** fetches the **latest** Go, Goreleaser and Protobuf versions via GitHub API. diff --git a/release/30-build-go-archive.sh b/release/30-build-go-archive.sh index 9c71d27d..00267d91 100755 --- a/release/30-build-go-archive.sh +++ b/release/30-build-go-archive.sh @@ -3,9 +3,6 @@ set -euo pipefail source release/source.sh -cp template.goreleaser.yaml .goreleaser.yaml -sed -i "s/__PROTO_VERSION__/$PROTO_VERSION/g" .goreleaser.yaml - set -x goreleaser check From c3edd8e65eede84609817f3dd762082957aa69b6 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 11:57:45 +0200 Subject: [PATCH 06/35] fix: goreleaser completions --- release/completions.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/completions.sh b/release/completions.sh index bf718f98..a635212c 100755 --- a/release/completions.sh +++ b/release/completions.sh @@ -4,6 +4,9 @@ set -e rm -rf completions mkdir completions + +cd src + for sh in bash zsh fish; do - go run src/protocurl.go completion "$sh" >"completions/protocurl.$sh" + go run protocurl.go completion "$sh" >"../completions/protocurl.$sh" done From e41c58217f18110441bd18cdabb9cc3a8e4d693b Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 12:55:03 +0200 Subject: [PATCH 07/35] feat: replace deprecated command --- release/30-build-go-archive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/30-build-go-archive.sh b/release/30-build-go-archive.sh index 00267d91..9fead641 100755 --- a/release/30-build-go-archive.sh +++ b/release/30-build-go-archive.sh @@ -11,7 +11,7 @@ echo "Using GORELEASER_CURRENT_TAG=$GORELEASER_CURRENT_TAG, GORELEASER_PREVIOUS_ GORELEASER_ARGS="" if [[ "$SNAPSHOT" == "true" ]]; then - GORELEASER_ARGS="--skip-announce" + GORELEASER_ARGS="--skip=announce" fi goreleaser release --clean $GORELEASER_ARGS From 9c3dddf9e4131e5340b63995dfd3c8e8a31f1457 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 12:59:54 +0200 Subject: [PATCH 08/35] feat: run cd in subshell --- release/completions.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/release/completions.sh b/release/completions.sh index a635212c..79527fa4 100755 --- a/release/completions.sh +++ b/release/completions.sh @@ -5,8 +5,10 @@ set -e rm -rf completions mkdir completions -cd src +( + cd src -for sh in bash zsh fish; do - go run protocurl.go completion "$sh" >"../completions/protocurl.$sh" -done + for sh in bash zsh fish; do + go run protocurl.go completion "$sh" >"../completions/protocurl.$sh" + done +) From 4dc0392b7dd151611d2bc580fa86b5d5208b059d Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 13:28:13 +0200 Subject: [PATCH 09/35] fix: remove completions for now --- .goreleaser.yaml | 27 +++++++++++++++++++++------ release/completions.sh | 10 +++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0edbdc56..f4b1ad83 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,8 +1,8 @@ # Documentation at https://goreleaser.com before: - hooks: - - ./release/completions.sh + hooks: [] + # - ./release/completions.sh # TODO: Fix completions build # https://goreleaser.com/customization/build/ builds: @@ -28,7 +28,7 @@ archives: # binary is added implicitly - README.md - LICENSE.md - - completions/* + # - completions/* ' TODO: Fix completions build # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/bin' dst: 'protocurl-internal/bin' @@ -86,6 +86,20 @@ nfpms: dst: '/opt/protocurl/protocurl-internal/bin' - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' + # Completions + # TODO: Fix completions build +# - src: ./completions/protocurl.bash +# dst: /usr/share/bash-completion/completions/protocurl +# file_info: +# mode: 0644 +# - src: ./completions/protocurl.fish +# dst: /usr/share/fish/vendor_completions.d/protocurl.fish +# file_info: +# mode: 0644 +# - src: ./completions/protocurl.zsh +# dst: /usr/share/zsh/vendor-completions/_protocurl +# file_info: +# mode: 0644 brews: - name: protocurl@{{ .Major }}.{{ .Minor }}.{{ .Patch }} @@ -108,9 +122,10 @@ brews: - name: curl install: |- bin.install "{{ .ProjectName }}" - bash_completion.install "completions/{{ .ProjectName }}.bash" => "{{ .ProjectName }}" - zsh_completion.install "completions/{{ .ProjectName }}.zsh" => "_{{ .ProjectName }}" - fish_completion.install "completions/{{ .ProjectName }}.fish" +# TODO: Make completion build run +# bash_completion.install "completions/{{ .ProjectName }}.bash" => "{{ .ProjectName }}" +# zsh_completion.install "completions/{{ .ProjectName }}.zsh" => "_{{ .ProjectName }}" +# fish_completion.install "completions/{{ .ProjectName }}.fish" release: # If set to auto, will mark the release as not ready for production diff --git a/release/completions.sh b/release/completions.sh index 79527fa4..cb7a543e 100755 --- a/release/completions.sh +++ b/release/completions.sh @@ -5,10 +5,6 @@ set -e rm -rf completions mkdir completions -( - cd src - - for sh in bash zsh fish; do - go run protocurl.go completion "$sh" >"../completions/protocurl.$sh" - done -) +for sh in bash zsh fish; do + go run -C src protocurl.go completion "$sh" >"completions/protocurl.$sh" +done From 9336c2f69295f35ca9a007628bf17213da79143c Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 16:51:23 +0200 Subject: [PATCH 10/35] fix: ci --- .goreleaser.yaml | 8 ++++---- dev/generate-local.Dockerfile.sh | 2 +- doc/generate-docs.sh | 2 +- release/0-get-latest-dependencies-versions.sh | 2 +- release/10-ensure-protoc-binaries-exist.sh | 2 +- release/10.1-get-protoc-binaries.sh | 2 +- release/100-check-latest-versions.sh | 2 +- release/101-save-latest-versions.sh | 2 +- release/20-install-go.sh | 2 +- release/30-build-go-archive.sh | 2 +- release/40-generate-Dockerfile.sh | 2 +- release/completions.sh | 2 +- release/source.sh | 2 +- test/suite/copy-test-results-output-to-expected.sh | 2 +- test/suite/linux/install-test-remove.sh | 2 +- test/suite/linux/package-alpine.sh | 2 +- test/suite/linux/package-debian.sh | 2 +- test/suite/setup.sh | 2 +- test/suite/test.sh | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f4b1ad83..28adb7aa 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -30,10 +30,10 @@ archives: - LICENSE.md # - completions/* ' TODO: Fix completions build # copy protoc binaries and their .proto files previously downloaded - - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/bin' + - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' dst: 'protocurl-internal/bin' strip_parent: true # avoids, that protoc is copied into protocurl-internal/bin/release/tmp/.../bin - - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' + - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: 'protocurl-internal/include/google/protobuf' strip_parent: true @@ -82,9 +82,9 @@ nfpms: - src: LICENSE.md dst: /opt/protocurl/LICENSE.md # copy protoc binaries and their .proto files previously downloaded - - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/bin' + - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' dst: '/opt/protocurl/protocurl-internal/bin' - - src: 'release/tmp/protoc-{{ .Version }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' + - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' # Completions # TODO: Fix completions build diff --git a/dev/generate-local.Dockerfile.sh b/dev/generate-local.Dockerfile.sh index 6929aad6..33465ade 100755 --- a/dev/generate-local.Dockerfile.sh +++ b/dev/generate-local.Dockerfile.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # Concatenate the dev dockerfile and the final release dockerfile to get the combined one diff --git a/doc/generate-docs.sh b/doc/generate-docs.sh index 2e99869b..52b50107 100755 --- a/doc/generate-docs.sh +++ b/doc/generate-docs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail WORKING_DIR="$1" diff --git a/release/0-get-latest-dependencies-versions.sh b/release/0-get-latest-dependencies-versions.sh index e02c38f6..2870c1f7 100755 --- a/release/0-get-latest-dependencies-versions.sh +++ b/release/0-get-latest-dependencies-versions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail LATEST_VERSION="" diff --git a/release/10-ensure-protoc-binaries-exist.sh b/release/10-ensure-protoc-binaries-exist.sh index 11400596..338cba65 100755 --- a/release/10-ensure-protoc-binaries-exist.sh +++ b/release/10-ensure-protoc-binaries-exist.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail source ./release/0-get-latest-dependencies-versions.sh diff --git a/release/10.1-get-protoc-binaries.sh b/release/10.1-get-protoc-binaries.sh index 84693b42..4490a718 100755 --- a/release/10.1-get-protoc-binaries.sh +++ b/release/10.1-get-protoc-binaries.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # platforms and architectures for which Google released pre-built binaries diff --git a/release/100-check-latest-versions.sh b/release/100-check-latest-versions.sh index a124bfe5..72252455 100755 --- a/release/100-check-latest-versions.sh +++ b/release/100-check-latest-versions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail SAVED="release/versions.txt" diff --git a/release/101-save-latest-versions.sh b/release/101-save-latest-versions.sh index 3b3efe2f..0c74ed69 100755 --- a/release/101-save-latest-versions.sh +++ b/release/101-save-latest-versions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # See RELEASE.md diff --git a/release/20-install-go.sh b/release/20-install-go.sh index 7a566806..c71ac8f7 100755 --- a/release/20-install-go.sh +++ b/release/20-install-go.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x diff --git a/release/30-build-go-archive.sh b/release/30-build-go-archive.sh index 9fead641..28ef7bc3 100755 --- a/release/30-build-go-archive.sh +++ b/release/30-build-go-archive.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail source release/source.sh diff --git a/release/40-generate-Dockerfile.sh b/release/40-generate-Dockerfile.sh index 575814b6..acceafc0 100755 --- a/release/40-generate-Dockerfile.sh +++ b/release/40-generate-Dockerfile.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail cat release/builder.Dockerfile <(echo "# ==================") release/final.Dockerfile >release/generated.Dockerfile diff --git a/release/completions.sh b/release/completions.sh index cb7a543e..40be3ff0 100755 --- a/release/completions.sh +++ b/release/completions.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # https://carlosbecker.com/posts/golang-completions-cobra/ set -e diff --git a/release/source.sh b/release/source.sh index 73ad4d5d..78130ba8 100755 --- a/release/source.sh +++ b/release/source.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # PRECONDITION: git fetch origin --tags diff --git a/test/suite/copy-test-results-output-to-expected.sh b/test/suite/copy-test-results-output-to-expected.sh index e5edbf33..93482580 100755 --- a/test/suite/copy-test-results-output-to-expected.sh +++ b/test/suite/copy-test-results-output-to-expected.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail source test/suite/setup.sh diff --git a/test/suite/linux/install-test-remove.sh b/test/suite/linux/install-test-remove.sh index d02c3875..1b6115e9 100755 --- a/test/suite/linux/install-test-remove.sh +++ b/test/suite/linux/install-test-remove.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # should be run inside ./test folder within a container to test packaged linux releases diff --git a/test/suite/linux/package-alpine.sh b/test/suite/linux/package-alpine.sh index 0d81dd1d..a7e688f1 100644 --- a/test/suite/linux/package-alpine.sh +++ b/test/suite/linux/package-alpine.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x diff --git a/test/suite/linux/package-debian.sh b/test/suite/linux/package-debian.sh index f0c52bc1..00c99052 100755 --- a/test/suite/linux/package-debian.sh +++ b/test/suite/linux/package-debian.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail setup() { diff --git a/test/suite/setup.sh b/test/suite/setup.sh index e06bfa49..2a0f695b 100755 --- a/test/suite/setup.sh +++ b/test/suite/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source release/source.sh diff --git a/test/suite/test.sh b/test/suite/test.sh index afdc74a0..294232cd 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail From 49ba1eb8c3d15fefd23b81223ad8bace48b72b12 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 16:58:15 +0200 Subject: [PATCH 11/35] fix: ci --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 28adb7aa..6bb1355b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -103,7 +103,7 @@ nfpms: brews: - name: protocurl@{{ .Major }}.{{ .Minor }}.{{ .Patch }} - homepage: https://gitlab.com/{{ .Env.PROJECT_PATH }} + homepage: https://gitlab.com/qaware/protocurl description: >- protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over From 13d328f00cd17064d35df047164e6c7738e6992e Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 17:07:30 +0200 Subject: [PATCH 12/35] fix: ci - use .ProjectName --- .goreleaser.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6bb1355b..1a6ead1f 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -6,7 +6,7 @@ before: # https://goreleaser.com/customization/build/ builds: - - binary: bin/protocurl + - binary: "bin/{{ .ProjectName }}" dir: src env: - CGO_ENABLED=0 @@ -39,7 +39,7 @@ archives: # Linux packages nfpms: - - package_name: protocurl + - package_name: "{{ .ProjectName }}" description: |- protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over @@ -67,20 +67,20 @@ nfpms: - gcompat # adds the ./bin/protocurl - bindir: /opt/protocurl + bindir: /opt/{{ .ProjectName }} # GoReleaser will automatically add the binaries. contents: - - src: /opt/protocurl/bin/protocurl - dst: /usr/bin/protocurl + - src: /opt/protocurl/bin/{{ .ProjectName }} + dst: /usr/bin/{{ .ProjectName }} type: "symlink" # NOTE: These files are listed again in the archives above. Keep them synced! # binary is added implicitly - src: README.md - dst: /opt/protocurl/README.md + dst: /opt/{{ .ProjectName }}/README.md - src: LICENSE.md - dst: /opt/protocurl/LICENSE.md + dst: /opt/{{ .ProjectName }}/LICENSE.md # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' dst: '/opt/protocurl/protocurl-internal/bin' @@ -88,16 +88,16 @@ nfpms: dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' # Completions # TODO: Fix completions build -# - src: ./completions/protocurl.bash -# dst: /usr/share/bash-completion/completions/protocurl +# - src: ./completions/{{ .ProjectName }}.bash +# dst: /usr/share/bash-completion/completions/{{ .ProjectName }} # file_info: # mode: 0644 -# - src: ./completions/protocurl.fish -# dst: /usr/share/fish/vendor_completions.d/protocurl.fish +# - src: ./completions/{{ .ProjectName }}.fish +# dst: /usr/share/fish/vendor_completions.d/{{ .ProjectName }}.fish # file_info: # mode: 0644 -# - src: ./completions/protocurl.zsh -# dst: /usr/share/zsh/vendor-completions/_protocurl +# - src: ./completions/{{ .ProjectName }}.zsh +# dst: /usr/share/zsh/vendor-completions/_{{ .ProjectName }} # file_info: # mode: 0644 From bbd5c8f6230f53f465b3e4046867a744f7513c4c Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 17:10:37 +0200 Subject: [PATCH 13/35] fix: ci - use .ProjectName --- .goreleaser.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 1a6ead1f..c659c026 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -31,10 +31,10 @@ archives: # - completions/* ' TODO: Fix completions build # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' - dst: 'protocurl-internal/bin' + dst: '{{ .ProjectName }}-internal/bin' strip_parent: true # avoids, that protoc is copied into protocurl-internal/bin/release/tmp/.../bin - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' - dst: 'protocurl-internal/include/google/protobuf' + dst: '{{ .ProjectName }}-internal/include/google/protobuf' strip_parent: true # Linux packages @@ -45,7 +45,7 @@ nfpms: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text formats. - homepage: https://github.com/qaware/protocurl + homepage: https://github.com/qaware/{{ .ProjectName }} license: MIT maintainer: GollyTicker priority: extra @@ -71,7 +71,7 @@ nfpms: # GoReleaser will automatically add the binaries. contents: - - src: /opt/protocurl/bin/{{ .ProjectName }} + - src: /opt/{{ .ProjectName }}/bin/{{ .ProjectName }} dst: /usr/bin/{{ .ProjectName }} type: "symlink" @@ -83,9 +83,9 @@ nfpms: dst: /opt/{{ .ProjectName }}/LICENSE.md # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' - dst: '/opt/protocurl/protocurl-internal/bin' + dst: '/opt/{{ .ProjectName }}/{{ .ProjectName }}-internal/bin' - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' - dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' + dst: '/opt/{{ .ProjectName }}/{{ .ProjectName }}-internal/include/google/protobuf' # Completions # TODO: Fix completions build # - src: ./completions/{{ .ProjectName }}.bash @@ -102,14 +102,14 @@ nfpms: # mode: 0644 brews: - - name: protocurl@{{ .Major }}.{{ .Minor }}.{{ .Patch }} - homepage: https://gitlab.com/qaware/protocurl + - name: {{ .ProjectName }}@{{ .Major }}.{{ .Minor }}.{{ .Patch }} + homepage: https://gitlab.com/qaware/{{ .ProjectName }} description: >- protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text formats. license: MIT - url_template: "https://github.com/qaware/protocurl/releases/{{ .Tag }}/{{ .ArtifactName }}" + url_template: "https://github.com/qaware/{{ .ProjectName }}/releases/{{ .Tag }}/{{ .ArtifactName }}" skip_upload: false # TODO: When finished set this to auto. For testing rc's are also deployed # GitHub/GitLab repository to push the formula to repository: From c13a365a23baaff7e74259286b400a513596967b Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 17:14:18 +0200 Subject: [PATCH 14/35] debug: try GITHUB_TOKEN --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c659c026..145de80a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -116,7 +116,7 @@ brews: owner: qaware name: homebrew-tap branch: main - token: "{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}" + token: "{{ .Env.GITHUB_TOKEN }}" folder: Formula dependencies: - name: curl From 979661922361ba506926adb92df02054c300bba1 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 17:16:57 +0200 Subject: [PATCH 15/35] fix: ci --- .goreleaser.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 145de80a..306627d1 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -67,7 +67,7 @@ nfpms: - gcompat # adds the ./bin/protocurl - bindir: /opt/{{ .ProjectName }} + bindir: "/opt/{{ .ProjectName }}" # GoReleaser will automatically add the binaries. contents: @@ -102,7 +102,7 @@ nfpms: # mode: 0644 brews: - - name: {{ .ProjectName }}@{{ .Major }}.{{ .Minor }}.{{ .Patch }} + - name: "{{ .ProjectName }}@{{ .Major }}.{{ .Minor }}.{{ .Patch }}" homepage: https://gitlab.com/qaware/{{ .ProjectName }} description: >- protoCURL is cURL for Protobuf: From 480aac784395b20f2996d8f4f63dab5371ce8101 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 17:21:46 +0200 Subject: [PATCH 16/35] debug: revert github token --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 306627d1..cf40bd67 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -116,7 +116,7 @@ brews: owner: qaware name: homebrew-tap branch: main - token: "{{ .Env.GITHUB_TOKEN }}" + token: "{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}" folder: Formula dependencies: - name: curl From 7a73444c772687d12d6af8330c3318d88bb46d9f Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Mon, 23 Oct 2023 17:26:46 +0200 Subject: [PATCH 17/35] debug: add lengt variable --- release/30-build-go-archive.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/30-build-go-archive.sh b/release/30-build-go-archive.sh index 28ef7bc3..cb7cb55c 100755 --- a/release/30-build-go-archive.sh +++ b/release/30-build-go-archive.sh @@ -14,6 +14,8 @@ if [[ "$SNAPSHOT" == "true" ]]; then GORELEASER_ARGS="--skip=announce" fi +echo "GH_TOKEN_QAWARE_TAP_REPO length: ${#GH_TOKEN_QAWARE_TAP_REPO}" + goreleaser release --clean $GORELEASER_ARGS # Alternate commands when testing release process locally From 16d39d325fb1cf5fd347b6bf9b6dc2713e01aab0 Mon Sep 17 00:00:00 2001 From: GollyTicker Date: Mon, 23 Oct 2023 17:32:53 +0200 Subject: [PATCH 18/35] export qaware/tap token to goreleaser --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23fd045d..3da67301 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,7 @@ jobs: export PATH=$PATH:/usr/local/go/bin export GORELEASER_CURRENT_TAG="v${{ github.event.inputs.version }}" export GORELEASER_PREVIOUS_TAG="${{ env.GORELEASER_PREVIOUS_TAG }}" + export GH_TOKEN_QAWARE_TAP_REPO="${{ secrets.GH_TOKEN_QAWARE_TAP_REPO }}" ./release/30-build-go-archive.sh - name: DockerHub Login From 9ee365b5c01f6b4dd18483cd6ef461ddc3a44c51 Mon Sep 17 00:00:00 2001 From: GollyTicker Date: Mon, 23 Oct 2023 17:34:01 +0200 Subject: [PATCH 19/35] better variant --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3da67301..aa27a4a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,11 +60,11 @@ jobs: - name: Build Archive env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN_QAWARE_TAP_REPO: ${{ secrets.GH_TOKEN_QAWARE_TAP_REPO }} run: | export PATH=$PATH:/usr/local/go/bin export GORELEASER_CURRENT_TAG="v${{ github.event.inputs.version }}" export GORELEASER_PREVIOUS_TAG="${{ env.GORELEASER_PREVIOUS_TAG }}" - export GH_TOKEN_QAWARE_TAP_REPO="${{ secrets.GH_TOKEN_QAWARE_TAP_REPO }}" ./release/30-build-go-archive.sh - name: DockerHub Login From d7343e64f3fabe0b86b1b5c28600f994174171c5 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 10:42:46 +0200 Subject: [PATCH 20/35] Revert "debug: add lengt variable" This reverts commit 7a73444c772687d12d6af8330c3318d88bb46d9f. --- release/30-build-go-archive.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/release/30-build-go-archive.sh b/release/30-build-go-archive.sh index cb7cb55c..28ef7bc3 100755 --- a/release/30-build-go-archive.sh +++ b/release/30-build-go-archive.sh @@ -14,8 +14,6 @@ if [[ "$SNAPSHOT" == "true" ]]; then GORELEASER_ARGS="--skip=announce" fi -echo "GH_TOKEN_QAWARE_TAP_REPO length: ${#GH_TOKEN_QAWARE_TAP_REPO}" - goreleaser release --clean $GORELEASER_ARGS # Alternate commands when testing release process locally From 2b28930e898308d5ae234ce5f56b0581deaf9d96 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 11:45:54 +0200 Subject: [PATCH 21/35] feat: add shellcheck to CI --- .github/workflows/test.yml | 5 +++++ release/0-get-latest-dependencies-versions.sh | 3 ++- release/10-ensure-protoc-binaries-exist.sh | 2 +- release/source.sh | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df78a0a2..c7eda52d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + scandir: 'release' + - name: Setup run: | sudo apt-get -q update diff --git a/release/0-get-latest-dependencies-versions.sh b/release/0-get-latest-dependencies-versions.sh index 2870c1f7..ff572a6c 100755 --- a/release/0-get-latest-dependencies-versions.sh +++ b/release/0-get-latest-dependencies-versions.sh @@ -23,6 +23,7 @@ retrieveLatestVersion() { REPO="$2" TAG_FILTER="$3" + # shellcheck disable=SC2001 FILE_FRIENDLY_NAME="$(echo "$REPO" | sed 's#/#.#g')" CACHE_FILE="release/.cache/$FILE_FRIENDLY_NAME.cache.json" @@ -51,7 +52,7 @@ retrieveLatestVersion() { -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$REPO/$ENDPOINT")" - STATUS_CODE_LINE="$(cat "$HEADERS_FILE" | head -n 1)" + STATUS_CODE_LINE="$(head -n 1 < "$HEADERS_FILE")" if [[ "$STATUS_CODE_LINE" == *" 200"* ]]; then echo "Populating cache..." diff --git a/release/10-ensure-protoc-binaries-exist.sh b/release/10-ensure-protoc-binaries-exist.sh index 338cba65..9c428b9b 100755 --- a/release/10-ensure-protoc-binaries-exist.sh +++ b/release/10-ensure-protoc-binaries-exist.sh @@ -4,7 +4,7 @@ set -euo pipefail source ./release/0-get-latest-dependencies-versions.sh FILES_EXIST="true" -ls release/tmp/protoc-$PROTO_VERSION-*.zip > /dev/null 2>&1 || FILES_EXIST="false" +ls release/tmp/protoc-"$PROTO_VERSION"-*.zip > /dev/null 2>&1 || FILES_EXIST="false" if [[ "$FILES_EXIST" == "true" ]]; then echo "Found protoc binaries for $PROTO_VERSION." diff --git a/release/source.sh b/release/source.sh index 78130ba8..160b3b68 100755 --- a/release/source.sh +++ b/release/source.sh @@ -6,7 +6,8 @@ set -euo pipefail source ./release/10-ensure-protoc-binaries-exist.sh # should be one of 386, amd64 and arm64 -export BUILD_ARCH="$(uname -m | sed "s/x86_64/amd64/" | sed "s/x86_32/386/" | sed "s/aarch_64/arm64/")" +BUILD_ARCH="$(uname -m | sed "s/x86_64/amd64/" | sed "s/x86_32/386/" | sed "s/aarch_64/arm64/")" +export BUILD_ARCH # ensure, that 1.2.3-rc < 1.2.3, since the opposite is the default git config versionsort.suffix - From f47e4ad2c0209548cd3a423e1eb3edd7dec1b702 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 13:14:10 +0200 Subject: [PATCH 22/35] fix; shellcheck --- .github/workflows/test.yml | 2 - .shellcheckrc | 1 + doc/generate-docs.sh | 4 +- .../copy-test-results-output-to-expected.sh | 3 +- test/suite/linux/install-test-remove.sh | 1 + test/suite/setup.sh | 45 ++++++++++--------- test/suite/test.sh | 15 ++++--- 7 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 .shellcheckrc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7eda52d..82a9f94f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,6 @@ jobs: - name: Run ShellCheck uses: ludeeus/action-shellcheck@master - with: - scandir: 'release' - name: Setup run: | diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000..8226afb6 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +external-sources=true diff --git a/doc/generate-docs.sh b/doc/generate-docs.sh index 52b50107..cac63885 100755 --- a/doc/generate-docs.sh +++ b/doc/generate-docs.sh @@ -212,8 +212,8 @@ echo "Generating README.md..." README_TEMPLATE="$(cat doc/template.README.md)" # replacements ============================ -echo "$README_TEMPLATE" | - sed "s%___EXAMPLE_1_OUT___%$EXAMPLE_1_OUT%" >README.md +# shellcheck disable=SC2001 +sed "s%___EXAMPLE_1_OUT___%$EXAMPLE_1_OUT%" >README.md <<<"$README_TEMPLATE" normaliseOutput README.md diff --git a/test/suite/copy-test-results-output-to-expected.sh b/test/suite/copy-test-results-output-to-expected.sh index 93482580..6e33f982 100755 --- a/test/suite/copy-test-results-output-to-expected.sh +++ b/test/suite/copy-test-results-output-to-expected.sh @@ -8,8 +8,7 @@ source test/suite/setup.sh FILES="$(ls -a test/results/*-out.txt)" copyIfDiff() { - meaningfulDiff "$1" "${1%"-out.txt"}-expected.txt" >/dev/null - if [[ "$?" == "0" ]]; then + if meaningfulDiff "$1" "${1%"-out.txt"}-expected.txt" >/dev/null; then echo "✅ ${1%"-out.txt"}" else cp "$1" "${1%"-out.txt"}-expected.txt" diff --git a/test/suite/linux/install-test-remove.sh b/test/suite/linux/install-test-remove.sh index 1b6115e9..1dfa033e 100755 --- a/test/suite/linux/install-test-remove.sh +++ b/test/suite/linux/install-test-remove.sh @@ -7,6 +7,7 @@ OS_NAME="$1" EXT="$2" URL_NO_EXT="$3" +# shellcheck source=test/suite/linux/package-debian.sh source "./test/suite/linux/package-${OS_NAME}.sh" setup diff --git a/test/suite/setup.sh b/test/suite/setup.sh index 2a0f695b..1b0d9020 100755 --- a/test/suite/setup.sh +++ b/test/suite/setup.sh @@ -12,8 +12,9 @@ buildProtocurl() { if [[ -v PROTOCURL_RELEASE_VERSION ]]; then export PROTOCURL_IMAGE_ORIGINAL="qaware/protocurl:$PROTOCURL_RELEASE_VERSION" export PROTOCURL_IMAGE="qaware/protocurl:$PROTOCURL_RELEASE_VERSION-test" - echo "Pulling $PROTOCURL_IMAGE_ORIGINAL ..." && docker pull $PROTOCURL_IMAGE_ORIGINAL && echo "Done." + echo "Pulling $PROTOCURL_IMAGE_ORIGINAL ..." && docker pull "$PROTOCURL_IMAGE_ORIGINAL" && echo "Done." + # shellcheck disable=SC2317 customNormaliseOutput() { sed -i -E "s/protocurl version .*, build .*,/protocurl version , build ,/g" "$1" sed -i -E "s/protocurl [0-9].*, build .*,/protocurl , build ,/g" "$1" @@ -25,8 +26,10 @@ buildProtocurl() { ./dev/generate-local.Dockerfile.sh BUILD_ARGS="-q -f dev/generated.local.Dockerfile" BUILD_ARGS="$BUILD_ARGS --build-arg PROTO_VERSION=$PROTO_VERSION" + # shellcheck disable=SC2153 BUILD_ARGS="$BUILD_ARGS --build-arg ARCH=$BUILD_ARCH" BUILD_ARGS="$BUILD_ARGS --build-arg GO_DOWNLOAD_URL_ARCH_TEMPLATE=$GO_DOWNLOAD_URL_ARCH_TEMPLATE" + # shellcheck disable=SC2086 echo "Building $PROTOCURL_IMAGE_ORIGINAL ..." && docker build --target final -t $PROTOCURL_IMAGE_ORIGINAL $BUILD_ARGS . && echo "Done." @@ -34,25 +37,27 @@ buildProtocurl() { echo "Building test image variant of protocurl including additonal executables ..." TMP_DOCKERFILE="test/suite/tmp.Dockerfile" - echo "" >$TMP_DOCKERFILE - grep "^FROM " release/builder.Dockerfile >>$TMP_DOCKERFILE - # add inotify to binaries to test tmp-file permissions. also add pkill for cleanup - echo "RUN apt-get update && apt-get install -y inotify-tools procps" >>$TMP_DOCKERFILE - echo "# =============" >>$TMP_DOCKERFILE - echo "FROM $PROTOCURL_IMAGE_ORIGINAL as final" >>$TMP_DOCKERFILE - echo "COPY --from=builder /bin/* /bin/" >>$TMP_DOCKERFILE - echo "COPY --from=builder /usr/bin/* /usr/bin/" >>$TMP_DOCKERFILE - echo " -COPY --from=builder /lib/*-linux-gnu /lib/x86_64-linux-gnu/ -COPY --from=builder /lib/*-linux-gnu /lib/aarch_64-linux-gnu/ -COPY --from=builder /usr/lib/*-linux-gnu /usr/lib/x86_64-linux-gnu/ -COPY --from=builder /usr/lib/*-linux-gnu /usr/lib/aarch_64-linux-gnu/ -COPY --from=builder /lib64*/ld-linux-*.so.2 /lib64/ - " >>$TMP_DOCKERFILE - grep "^ENTRYPOINT " release/final.Dockerfile >>$TMP_DOCKERFILE - remove-leading-spaces-inplace $TMP_DOCKERFILE - - cat $TMP_DOCKERFILE | docker build --target final -t $PROTOCURL_IMAGE -q -f - . + { + echo "" + grep "^FROM " release/builder.Dockerfile + # add inotify to binaries to test tmp-file permissions. also add pkill for cleanup + echo "RUN apt-get update && apt-get install -y inotify-tools procps" + echo "# =============" + echo "FROM $PROTOCURL_IMAGE_ORIGINAL as final" + echo "COPY --from=builder /bin/* /bin/" + echo "COPY --from=builder /usr/bin/* /usr/bin/" + echo " + COPY --from=builder /lib/*-linux-gnu /lib/x86_64-linux-gnu/ + COPY --from=builder /lib/*-linux-gnu /lib/aarch_64-linux-gnu/ + COPY --from=builder /usr/lib/*-linux-gnu /usr/lib/x86_64-linux-gnu/ + COPY --from=builder /usr/lib/*-linux-gnu /usr/lib/aarch_64-linux-gnu/ + COPY --from=builder /lib64*/ld-linux-*.so.2 /lib64/ + " + grep "^ENTRYPOINT " release/final.Dockerfile + } >"$TMP_DOCKERFILE" + remove-leading-spaces-inplace "$TMP_DOCKERFILE" + + docker build --target final -t "$PROTOCURL_IMAGE" -q -f - . <"$TMP_DOCKERFILE" echo "Done." } export -f buildProtocurl diff --git a/test/suite/test.sh b/test/suite/test.sh index 294232cd..e3c44eb0 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -53,14 +53,14 @@ testSingleRequest() { 2>"$OUT_ERR" >>"$OUT" EXIT_CODE="$?" - echo "######### STDERR #########" >>"$OUT" - cat "$OUT_ERR" >>"$OUT" + { + echo "######### STDERR #########" + cat "$OUT_ERR" + echo "######### EXIT $EXIT_CODE #########" + } >>"$OUT" - echo "######### EXIT $EXIT_CODE #########" >>"$OUT" - meaningfulDiff "$EXPECTED" "$OUT" >/dev/null - - if [[ "$?" != 0 ]]; then + if ! meaningfulDiff "$EXPECTED" "$OUT" >/dev/null; then export TESTS_SUCCESS="false" echo "❌❌❌ FAILURE ❌❌❌ - $FILENAME" echo "=== Found difference between expected and actual output (ignoring $NORMALISED_ASPECTS) ===" @@ -99,11 +99,12 @@ runAllTests() { # Convert each element in the JSON to the corresponding call of the testSingleRequest function. # Simply look at the produced run-testcases.sh file to see what it looks like. CONVERT_TESTCASE_TO_SINGLE_TEST_INVOCATION=".[] | \"testSingleSpec \(.filename|@sh) \(.args|join(\" \")|@sh) \(.beforeTestBash // \"\"|@sh) \(.afterTestBash // \"\"|@sh) \((.rerunwithArgForEachElement // [])|@sh)\"" - cat test/suite/testcases.json | jq -r "$CONVERT_TESTCASE_TO_SINGLE_TEST_INVOCATION" >./test/suite/run-testcases.sh + jq -r "$CONVERT_TESTCASE_TO_SINGLE_TEST_INVOCATION" >./test/suite/run-testcases.sh < test/suite/testcases.json export -f testSingleSpec export -f testSingleRequest chmod +x ./test/suite/run-testcases.sh + # shellcheck source=/dev/null source ./test/suite/run-testcases.sh echo "=== Finished Running ALL Tests ===" From b8ac1c24a9150c21bbd5c4bfbea7958672ce93e3 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 14:37:23 +0200 Subject: [PATCH 23/35] fix: brew push --- .goreleaser.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index cf40bd67..570c5c03 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -113,10 +113,12 @@ brews: skip_upload: false # TODO: When finished set this to auto. For testing rc's are also deployed # GitHub/GitLab repository to push the formula to repository: - owner: qaware - name: homebrew-tap + # To use the owner/name schema a PAT is needed. + # This is bad as a user is linked to it => Deploy Key is better branch: main - token: "{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}" + git: + url: ssh://git@github.com:qaware/homebrew-tap.git + private_key: '{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}' folder: Formula dependencies: - name: curl From 63f163fc6629144e421792d5c9636b2ed2f075af Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 14:56:36 +0200 Subject: [PATCH 24/35] feat(ci): write secret to file and use it --- .github/workflows/release.yml | 1 + .goreleaser.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa27a4a1..3d634bc2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,6 +65,7 @@ jobs: export PATH=$PATH:/usr/local/go/bin export GORELEASER_CURRENT_TAG="v${{ github.event.inputs.version }}" export GORELEASER_PREVIOUS_TAG="${{ env.GORELEASER_PREVIOUS_TAG }}" + echo "$GH_TOKEN_QAWARE_TAP_REPO" > /tmp/GH_TOKEN_QAWARE_TAP_REPO ./release/30-build-go-archive.sh - name: DockerHub Login diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 570c5c03..8e6f5b01 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -118,7 +118,7 @@ brews: branch: main git: url: ssh://git@github.com:qaware/homebrew-tap.git - private_key: '{{ .Env.GH_TOKEN_QAWARE_TAP_REPO }}' + private_key: /tmp/GH_TOKEN_QAWARE_TAP_REPO folder: Formula dependencies: - name: curl From f9550fb7902ebfa3bb76f5d2529e0f6ccea0eaa3 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 14:57:47 +0200 Subject: [PATCH 25/35] feat(ci): style improvement --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d634bc2..a861cd80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,9 +62,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN_QAWARE_TAP_REPO: ${{ secrets.GH_TOKEN_QAWARE_TAP_REPO }} run: | - export PATH=$PATH:/usr/local/go/bin - export GORELEASER_CURRENT_TAG="v${{ github.event.inputs.version }}" - export GORELEASER_PREVIOUS_TAG="${{ env.GORELEASER_PREVIOUS_TAG }}" + PATH=$PATH:/usr/local/go/bin + GORELEASER_CURRENT_TAG="v${{ github.event.inputs.version }}" + GORELEASER_PREVIOUS_TAG="${{ env.GORELEASER_PREVIOUS_TAG }}" + export PATH GORELEASER_CURRENT_TAG GORELEASER_PREVIOUS_TAG echo "$GH_TOKEN_QAWARE_TAP_REPO" > /tmp/GH_TOKEN_QAWARE_TAP_REPO ./release/30-build-go-archive.sh From 47bf596c86b2488ee5add6afd7859426a72dc4ff Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 15:03:32 +0200 Subject: [PATCH 26/35] fix(ci): repo owner and name --- .goreleaser.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8e6f5b01..5b312b1d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -113,8 +113,8 @@ brews: skip_upload: false # TODO: When finished set this to auto. For testing rc's are also deployed # GitHub/GitLab repository to push the formula to repository: - # To use the owner/name schema a PAT is needed. - # This is bad as a user is linked to it => Deploy Key is better + owner: qaware + name: homebrew-tap branch: main git: url: ssh://git@github.com:qaware/homebrew-tap.git From 294b9206746ff41f729b676394df47a0978a87b3 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 15:06:35 +0200 Subject: [PATCH 27/35] fix(ci): add gorelaser check --- release/30-build-go-archive.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/release/30-build-go-archive.sh b/release/30-build-go-archive.sh index 28ef7bc3..6237fc50 100755 --- a/release/30-build-go-archive.sh +++ b/release/30-build-go-archive.sh @@ -14,6 +14,7 @@ if [[ "$SNAPSHOT" == "true" ]]; then GORELEASER_ARGS="--skip=announce" fi +goreleaser check goreleaser release --clean $GORELEASER_ARGS # Alternate commands when testing release process locally From 3d1171b744a7635db688241c884bca53cccef9a4 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 15:39:33 +0200 Subject: [PATCH 28/35] fix(ci): git repo url --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5b312b1d..f2a1286c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -117,7 +117,7 @@ brews: name: homebrew-tap branch: main git: - url: ssh://git@github.com:qaware/homebrew-tap.git + url: git@github.com:qaware/homebrew-tap.git private_key: /tmp/GH_TOKEN_QAWARE_TAP_REPO folder: Formula dependencies: From 31f8004afed54a9dda8638ba2ada9bd6ede7d5cf Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 15:41:53 +0200 Subject: [PATCH 29/35] feat(ci): remove GH TOKEN file write --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a861cd80..33e3e4dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,6 +68,7 @@ jobs: export PATH GORELEASER_CURRENT_TAG GORELEASER_PREVIOUS_TAG echo "$GH_TOKEN_QAWARE_TAP_REPO" > /tmp/GH_TOKEN_QAWARE_TAP_REPO ./release/30-build-go-archive.sh + rm -rf /tmp/GH_TOKEN_QAWARE_TAP_REPO - name: DockerHub Login uses: docker/login-action@v3 From 6b5cae9917a871dbcd9064913d04abaca6073dbe Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 15:44:30 +0200 Subject: [PATCH 30/35] feat(ci): set skip_upload to auto as Formula should not be pushed to repo when its a rc --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f2a1286c..9186014c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -110,7 +110,7 @@ brews: HTTP REST endpoints using human-readable text formats. license: MIT url_template: "https://github.com/qaware/{{ .ProjectName }}/releases/{{ .Tag }}/{{ .ArtifactName }}" - skip_upload: false # TODO: When finished set this to auto. For testing rc's are also deployed + skip_upload: auto # GitHub/GitLab repository to push the formula to repository: owner: qaware From 2042f4534b35b0027389c2fcdcc5306b2f301976 Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 15:53:42 +0200 Subject: [PATCH 31/35] fix(ci): style --- test/suite/test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/suite/test.sh b/test/suite/test.sh index e3c44eb0..c98125a9 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -59,7 +59,6 @@ testSingleRequest() { echo "######### EXIT $EXIT_CODE #########" } >>"$OUT" - if ! meaningfulDiff "$EXPECTED" "$OUT" >/dev/null; then export TESTS_SUCCESS="false" echo "❌❌❌ FAILURE ❌❌❌ - $FILENAME" @@ -99,7 +98,7 @@ runAllTests() { # Convert each element in the JSON to the corresponding call of the testSingleRequest function. # Simply look at the produced run-testcases.sh file to see what it looks like. CONVERT_TESTCASE_TO_SINGLE_TEST_INVOCATION=".[] | \"testSingleSpec \(.filename|@sh) \(.args|join(\" \")|@sh) \(.beforeTestBash // \"\"|@sh) \(.afterTestBash // \"\"|@sh) \((.rerunwithArgForEachElement // [])|@sh)\"" - jq -r "$CONVERT_TESTCASE_TO_SINGLE_TEST_INVOCATION" >./test/suite/run-testcases.sh < test/suite/testcases.json + jq -r "$CONVERT_TESTCASE_TO_SINGLE_TEST_INVOCATION" ./test/suite/run-testcases.sh export -f testSingleSpec export -f testSingleRequest From b2d1ad50fdc8427977dbe27ae48aacd5c5f8963c Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 16:24:25 +0200 Subject: [PATCH 32/35] fix(ci): name and url template --- .goreleaser.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9186014c..d43c3b58 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -102,14 +102,17 @@ nfpms: # mode: 0644 brews: - - name: "{{ .ProjectName }}@{{ .Major }}.{{ .Minor }}.{{ .Patch }}" + # Due to brew conventions we only use Major and Minor versions: + # https://docs.brew.sh/Versions + # The qaware/homebrew-tap CI will take care of Alias creation for major and latest + - name: "{{ .ProjectName }}@{{ .Major }}.{{ .Minor }}" homepage: https://gitlab.com/qaware/{{ .ProjectName }} description: >- protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text formats. license: MIT - url_template: "https://github.com/qaware/{{ .ProjectName }}/releases/{{ .Tag }}/{{ .ArtifactName }}" + url_template: "https://github.com/qaware/{{ .ProjectName }}/releases/download/{{ .Tag }}/{{ .ArtifactName }}" skip_upload: auto # GitHub/GitLab repository to push the formula to repository: From 22d78ae66a24679517c64bc3d221255de8ddc43b Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 16:28:07 +0200 Subject: [PATCH 33/35] feat(ci): add system test --- .goreleaser.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index d43c3b58..8236fe1b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -131,6 +131,8 @@ brews: # bash_completion.install "completions/{{ .ProjectName }}.bash" => "{{ .ProjectName }}" # zsh_completion.install "completions/{{ .ProjectName }}.zsh" => "_{{ .ProjectName }}" # fish_completion.install "completions/{{ .ProjectName }}.fish" + test: | + system "#{bin}/{{ .ProjectName }} --version" release: # If set to auto, will mark the release as not ready for production From 465bdb1bc262cc2efbb74897e5d35ed4110837fb Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Tue, 24 Oct 2023 16:55:39 +0200 Subject: [PATCH 34/35] fix(ci): hopefully remove all non templated fields with tempaltes in it --- .goreleaser.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8236fe1b..9499822b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -6,7 +6,7 @@ before: # https://goreleaser.com/customization/build/ builds: - - binary: "bin/{{ .ProjectName }}" + - binary: bin/protocurl dir: src env: - CGO_ENABLED=0 @@ -31,10 +31,10 @@ archives: # - completions/* ' TODO: Fix completions build # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' - dst: '{{ .ProjectName }}-internal/bin' + dst: 'protocurl-internal/bin' strip_parent: true # avoids, that protoc is copied into protocurl-internal/bin/release/tmp/.../bin - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' - dst: '{{ .ProjectName }}-internal/include/google/protobuf' + dst: 'protocurl-internal/include/google/protobuf' strip_parent: true # Linux packages @@ -67,25 +67,25 @@ nfpms: - gcompat # adds the ./bin/protocurl - bindir: "/opt/{{ .ProjectName }}" + bindir: "/opt/protocurl" # GoReleaser will automatically add the binaries. contents: - - src: /opt/{{ .ProjectName }}/bin/{{ .ProjectName }} - dst: /usr/bin/{{ .ProjectName }} + - src: /opt/protocurl/bin/protocurl + dst: /usr/bin/protocurl type: "symlink" # NOTE: These files are listed again in the archives above. Keep them synced! # binary is added implicitly - src: README.md - dst: /opt/{{ .ProjectName }}/README.md + dst: /opt/protocurl/README.md - src: LICENSE.md - dst: /opt/{{ .ProjectName }}/LICENSE.md + dst: /opt/protocurl/LICENSE.md # copy protoc binaries and their .proto files previously downloaded - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/bin' - dst: '/opt/{{ .ProjectName }}/{{ .ProjectName }}-internal/bin' + dst: '/opt/protocurl/protocurl-internal/bin' - src: 'release/tmp/protoc-{{ .Env.PROTO_VERSION }}-{{ .Os }}-{{ .Arch }}/include/google/protobuf' - dst: '/opt/{{ .ProjectName }}/{{ .ProjectName }}-internal/include/google/protobuf' + dst: '/opt/protocurl/protocurl-internal/include/google/protobuf' # Completions # TODO: Fix completions build # - src: ./completions/{{ .ProjectName }}.bash @@ -106,13 +106,13 @@ brews: # https://docs.brew.sh/Versions # The qaware/homebrew-tap CI will take care of Alias creation for major and latest - name: "{{ .ProjectName }}@{{ .Major }}.{{ .Minor }}" - homepage: https://gitlab.com/qaware/{{ .ProjectName }} + homepage: https://gitlab.com/qaware/protocurl description: >- protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text formats. license: MIT - url_template: "https://github.com/qaware/{{ .ProjectName }}/releases/download/{{ .Tag }}/{{ .ArtifactName }}" + url_template: "https://github.com/qaware/protocurl/releases/download/{{ .Tag }}/{{ .ArtifactName }}" skip_upload: auto # GitHub/GitLab repository to push the formula to repository: From 5a4f2d53d6f9529136a6047208588e5840a069dc Mon Sep 17 00:00:00 2001 From: Alexander Eimer Date: Wed, 25 Oct 2023 17:15:01 +0200 Subject: [PATCH 35/35] fix(ci): adapt to brew requirements --- .goreleaser.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9499822b..0a9d44fe 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -102,10 +102,9 @@ nfpms: # mode: 0644 brews: - # Due to brew conventions we only use Major and Minor versions: - # https://docs.brew.sh/Versions - # The qaware/homebrew-tap CI will take care of Alias creation for major and latest - - name: "{{ .ProjectName }}@{{ .Major }}.{{ .Minor }}" + # We will deploy always the latest + - &brew + name: "{{ .ProjectName }}" homepage: https://gitlab.com/qaware/protocurl description: >- protoCURL is cURL for Protobuf: @@ -133,6 +132,9 @@ brews: # fish_completion.install "completions/{{ .ProjectName }}.fish" test: | system "#{bin}/{{ .ProjectName }} --version" + # Additionally Major is deployed to offer older versions + - <<: *brew + name: "{{ .ProjectName }}@{{ .Major }}" release: # If set to auto, will mark the release as not ready for production