Skip to content

Commit

Permalink
chore: fixup release action versioning and notes process (#1124)
Browse files Browse the repository at this point in the history
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

Makes sure that release notes are correctly drawn in and that we always
have the version set correctly in our CTFs.

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

This fixes up the release action in 2 important ways:

1. As part of the removal of the release notes we now no longer have a
file to use for release notes to give to goreleaser. This means we have
to temporarily create one
2. While discovering this I noticed that the Component Versions that are
built, are actually using the `VERSION` variable while
`EFFECTIVE_VERSION` is a combination of VERSION+COMMIT by default. I
didnt want to change this behavior originally, so now I started to use
VERSION for the Makefiles (which also means I had to export them as
settable). This now leads to correct CTF versions `v0.19.0-rc.1` instead
of `v0.19.0-dev` for example.

As such its a follow up from
#1120 and
#1077
  • Loading branch information
jakobmoellerdev authored Nov 22, 2024
1 parent a061dfd commit 9ce2b87
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
workflow_call:
inputs:
effective-version:
version:
type: string
required: false
description: "The version to use for the build"
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
PATH=$PATH:$(go env GOPATH)/bin \
CTF_TYPE=${{ env.CTF_TYPE }} \
EFFECTIVE_VERSION=${{ inputs.effective-version }} \
VERSION=${{ inputs.version }} \
PLATFORMS="${{ env.PLATFORMS }}" \
IMAGE_PLATFORMS="${{ env.IMAGE_PLATFORMS }}" \
make \
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ jobs:
components:
name: Component CTF Builds
uses: ./.github/workflows/components.yaml
needs: [check,release-version]
needs: [ check,release-version ]
with:
effective-version: ${{ needs.release-version.outputs.version_no_prefix }}
version: ${{ needs.release-version.outputs.version_no_prefix }}
upload-ctf: true
ref: ${{ github.ref }}
permissions:
Expand All @@ -105,7 +105,6 @@ jobs:
packages: write
env:
RELEASE_VERSION: ${{ needs.release-version.outputs.version }}
RELEASE_NOTES: ${{ fromJSON(needs.check.outputs.draft-release-notes).body }}
steps:
- name: Self Hosted Runner Post Job Cleanup Action
uses: TooMuch4U/actions-clean@v2.2
Expand Down Expand Up @@ -183,19 +182,24 @@ jobs:
msg="Release ${{ env.RELEASE_VERSION }}"
git tag --annotate --message "${msg}" ${{ env.RELEASE_VERSION }}
# push both the tag as well as a release branch with that tag.
git push origin releases/${{ env.RELEASE_VERSION }} ${{ env.RELEASE_VERSION }}
git push origin ${{ env.RELEASE_VERSION }}
- name: Create GPG Token file from Secret
run: |
echo "${{ secrets.GPG_PRIVATE_KEY_FOR_SIGNING }}" > ocm-releases-key.gpg
echo "GPG_KEY_PATH=ocm-releases-key.gpg" >> $GITHUB_ENV
- name: Setup Release Notes as File to make it readable by GoReleaser
run: |
echo "${{ fromJSON(needs.check.outputs.draft-release-notes).body }}" > $RUNNER_TEMP/RELEASE_NOTES.md
echo "RELEASE_NOTES=$RUNNER_TEMP/RELEASE_NOTES.md" >> $GITHUB_ENV
cat $RUNNER_TEMP/RELEASE_NOTES.md
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: 2.1.0
args: release --clean --timeout 60m --skip=validate --config=.github/config/goreleaser.yaml --release-notes=${{ env.RELEASE_NOTES_FILE }}
args: release --clean --timeout 60m --skip=validate --config=.github/config/goreleaser.yaml --release-notes=${{ env.RELEASE_NOTES }}
env:
GITHUBORG: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion components/demoplugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ PLATFORMS ?= linux/amd64 linux/arm64
CTF_TYPE ?= directory

REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
ifeq ($(VERSION),)
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
endif
COMMIT = $(shell git rev-parse --verify HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
Expand Down
4 changes: 3 additions & 1 deletion components/ecrplugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ CTF_TYPE ?= directory


REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
ifeq ($(VERSION),)
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
endif
COMMIT = $(shell git rev-parse --verify HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
Expand Down
6 changes: 4 additions & 2 deletions components/helmdemo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ CTF_TYPE ?= directory
HELMINSTCOMP = $(PROVIDER)/toi/installers/helminstaller

REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
ifeq ($(VERSION),)
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
endif
COMMIT = $(shell git rev-parse --verify HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION-COMMIT
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(COMMIT)
Expand Down
4 changes: 3 additions & 1 deletion components/helminstaller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ IMAGE_PLATFORMS ?= linux/amd64 linux/arm64
CTF_TYPE ?= directory

REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
ifeq ($(VERSION),)
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
endif
COMMIT := $(shell git rev-parse --verify HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION-COMMIT
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(COMMIT)
Expand Down
4 changes: 3 additions & 1 deletion components/ocmcli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ CTF_TYPE ?= directory

REPO_ROOT := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))../..
GIT_TREE_STATE = $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
ifeq ($(VERSION),)
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
endif
COMMIT = $(shell git rev-parse --verify HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
Expand Down
6 changes: 4 additions & 2 deletions components/subchartsdemo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ PODINFO_CHART_VERSION = 6.3.5

REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
GIT_TREE_STATE = $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)
VERSION = $(shell go run $(REPO_ROOT)/api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
ifeq ($(VERSION),)
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
endif
COMMIT = $(shell git rev-parse --verify HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION-COMMIT
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(COMMIT)
Expand Down

0 comments on commit 9ce2b87

Please sign in to comment.