From aaeb3b322159784dfaaf8b053335eccb62e8e00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sat, 19 Jul 2025 20:27:49 +0200 Subject: [PATCH] release: Copy the VERSION file to the tarball MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the release itself, let's simply copy the VERSION file to the tarball. To do so, we had to change the logic that merges the build, as at that point the tag is not yet pushed to the repo. Signed-off-by: Fabiano FidĂȘncio --- .../workflows/build-kata-static-tarball-amd64.yaml | 2 ++ .../workflows/build-kata-static-tarball-arm64.yaml | 2 ++ .../workflows/build-kata-static-tarball-ppc64le.yaml | 2 ++ .../workflows/build-kata-static-tarball-s390x.yaml | 2 ++ .../local-build/kata-deploy-merge-builds.sh | 11 ++++++++++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-kata-static-tarball-amd64.yaml b/.github/workflows/build-kata-static-tarball-amd64.yaml index f4e761b1bf..f5b25ed978 100644 --- a/.github/workflows/build-kata-static-tarball-amd64.yaml +++ b/.github/workflows/build-kata-static-tarball-amd64.yaml @@ -343,6 +343,8 @@ jobs: - name: merge-artifacts run: | ./tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh kata-artifacts versions.yaml + env: + RELEASE: ${{ inputs.stage == 'release' && 'yes' || 'no' }} - name: store-artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/.github/workflows/build-kata-static-tarball-arm64.yaml b/.github/workflows/build-kata-static-tarball-arm64.yaml index 58609159ad..fc9376c935 100644 --- a/.github/workflows/build-kata-static-tarball-arm64.yaml +++ b/.github/workflows/build-kata-static-tarball-arm64.yaml @@ -313,6 +313,8 @@ jobs: - name: merge-artifacts run: | ./tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh kata-artifacts versions.yaml + env: + RELEASE: ${{ inputs.stage == 'release' && 'yes' || 'no' }} - name: store-artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/.github/workflows/build-kata-static-tarball-ppc64le.yaml b/.github/workflows/build-kata-static-tarball-ppc64le.yaml index 2f4be990f8..bfe1e9aa53 100644 --- a/.github/workflows/build-kata-static-tarball-ppc64le.yaml +++ b/.github/workflows/build-kata-static-tarball-ppc64le.yaml @@ -256,6 +256,8 @@ jobs: - name: merge-artifacts run: | ./tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh kata-artifacts versions.yaml + env: + RELEASE: ${{ inputs.stage == 'release' && 'yes' || 'no' }} - name: store-artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/.github/workflows/build-kata-static-tarball-s390x.yaml b/.github/workflows/build-kata-static-tarball-s390x.yaml index ac7220aaaa..caa905f303 100644 --- a/.github/workflows/build-kata-static-tarball-s390x.yaml +++ b/.github/workflows/build-kata-static-tarball-s390x.yaml @@ -342,6 +342,8 @@ jobs: - name: merge-artifacts run: | ./tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh kata-artifacts versions.yaml + env: + RELEASE: ${{ inputs.stage == 'release' && 'yes' || 'no' }} - name: store-artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh b/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh index 4e30b88937..1a0944a6d4 100755 --- a/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh +++ b/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh @@ -10,6 +10,9 @@ set -o nounset set -o pipefail set -o errtrace +this_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo_root_dir="$(cd "${this_script_dir}/../../../../" && pwd)" + kata_build_dir=${1:-build} kata_versions_yaml_file=${2:-""} @@ -32,7 +35,13 @@ pushd ${tarball_content_dir} shim_path=$(find . -name ${shim} | sort | head -1) prefix=${shim_path%"bin/${shim}"} - echo "$(git describe --tags)" > ${prefix}/VERSION + if [[ "${RELEASE:-no}" == "yes" ]] && [[ -f "${repo_root_dir}/VERSION" ]]; then + # In this case the tag was not published yet, + # thus we need to rely on the VERSION file. + cp "${repo_root_dir}/VERSION" "${prefix}/" + else + echo "$(git describe --tags)" > "${prefix}/VERSION" + fi [[ -n "${kata_versions_yaml_file}" ]] && cp ${kata_versions_yaml_file_path} ${prefix}/ popd