From 41ade01e5cb7f31ec783024a1d776ca6260d40e9 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Tue, 18 May 2021 08:31:31 -0600 Subject: [PATCH 1/4] add custom build settings for releaser --- .goreleaser.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 8f2973681e..310396eb93 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,9 +11,8 @@ builds: env: - CGO_ENABLED=0 hooks: - pre: export CURRENT_DIR=pwd - pre: $(CURRENT_DIR)/tools/download-deps.sh $(CURRENT_DIR)/tools/dependencies.toml pre: export BRANCH=git rev-parse --abbrev-ref HEAD + pre: export CURRENT_DIR=pwd pre: export FLUX_VERSION=$(CURRENT_DIR)/tools/bin/stoml $(CURRENT_DIR)/tools/dependencies.toml flux.version id: linux goos: From be86b405aee74a061a22b292a8cbd1250bea5297 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Wed, 19 May 2021 14:49:52 -0600 Subject: [PATCH 2/4] add stoml install --- .goreleaser.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 310396eb93..8f2973681e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,8 +11,9 @@ builds: env: - CGO_ENABLED=0 hooks: - pre: export BRANCH=git rev-parse --abbrev-ref HEAD pre: export CURRENT_DIR=pwd + pre: $(CURRENT_DIR)/tools/download-deps.sh $(CURRENT_DIR)/tools/dependencies.toml + pre: export BRANCH=git rev-parse --abbrev-ref HEAD pre: export FLUX_VERSION=$(CURRENT_DIR)/tools/bin/stoml $(CURRENT_DIR)/tools/dependencies.toml flux.version id: linux goos: From 6a32695535495f8d7afc63bcdab95999f29d2100 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Wed, 19 May 2021 15:11:38 -0600 Subject: [PATCH 3/4] only one pre is allowed --- .goreleaser.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 8f2973681e..f9e10fdfa8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,10 +11,10 @@ builds: env: - CGO_ENABLED=0 hooks: - pre: export CURRENT_DIR=pwd - pre: $(CURRENT_DIR)/tools/download-deps.sh $(CURRENT_DIR)/tools/dependencies.toml - pre: export BRANCH=git rev-parse --abbrev-ref HEAD - pre: export FLUX_VERSION=$(CURRENT_DIR)/tools/bin/stoml $(CURRENT_DIR)/tools/dependencies.toml flux.version + pre: export CURRENT_DIR=pwd && \ + $(CURRENT_DIR)/tools/download-deps.sh $(CURRENT_DIR)/tools/dependencies.toml && \ + export BRANCH=git rev-parse --abbrev-ref HEAD && \ + export FLUX_VERSION=$(CURRENT_DIR)/tools/bin/stoml $(CURRENT_DIR)/tools/dependencies.toml flux.version && \ id: linux goos: - linux From 803af814a7c25566fc9ac8a289eedaee425c5ba1 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Fri, 21 May 2021 15:32:49 -0600 Subject: [PATCH 4/4] working release --- .github/workflows/release.yaml | 28 ++++++++-------------------- .goreleaser.yml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 036261aad8..974b2bc120 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,26 +16,6 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.16.x - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: all - - name: Setup Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - with: - buildkitd-flags: "--debug" - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ secrets.GHCR_USERNAME }} - password: ${{ secrets.GHCR_TOKEN }} - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - name: Download release notes utility env: GH_REL_URL: https://github.com/buchanae/github-release-notes/releases/download/0.2.0/github-release-notes-linux-amd64-0.2.0.tar.gz @@ -46,6 +26,11 @@ jobs: github-release-notes -org weaveworks -repo weave-gitops -include-author >> /tmp/release.txt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Set env var + run: | + make dependencies + echo "BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV + echo "FLUX_VERSION=$($(pwd)/tools/bin/stoml $(pwd)/tools/dependencies.toml flux.version)" >> $GITHUB_ENV - name: Run GoReleaser uses: goreleaser/goreleaser-action@v1 with: @@ -53,3 +38,6 @@ jobs: args: release --release-notes=/tmp/release.txt --skip-validate env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ env.BRANCH }} + FLUX_VERSION: ${{ env.FLUX_VERSION }} + diff --git a/.goreleaser.yml b/.goreleaser.yml index f9e10fdfa8..dd12fd90f1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,20 +1,20 @@ project_name: wego +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy builds: - <<: &build_defaults binary: wego main: ./cmd/wego ldflags: - -X github.com/weaveworks/weave-gitops/cmd/wego/version.BuildTime={{.Date}} - - -X github.com/weaveworks/weave-gitops/cmd/wego/version.Branch=$(BRANCH) + - -X github.com/weaveworks/weave-gitops/cmd/wego/version.Branch={{ .Env.BRANCH}} - -X github.com/weaveworks/weave-gitops/cmd/wego/version.GitCommit={{.Commit}} - - -X github.com/weaveworks/weave-gitops/pkg/version.FluxVersion=$(FLUX_VERSION) + - -X github.com/weaveworks/weave-gitops/pkg/version.FluxVersion={{ .Env.FLUX_VERSION }} env: - CGO_ENABLED=0 - hooks: - pre: export CURRENT_DIR=pwd && \ - $(CURRENT_DIR)/tools/download-deps.sh $(CURRENT_DIR)/tools/dependencies.toml && \ - export BRANCH=git rev-parse --abbrev-ref HEAD && \ - export FLUX_VERSION=$(CURRENT_DIR)/tools/bin/stoml $(CURRENT_DIR)/tools/dependencies.toml flux.version && \ id: linux goos: - linux @@ -30,4 +30,4 @@ builds: - darwin goarch: - amd64 - - arm64 + - arm64 \ No newline at end of file