From 94b30fcb14797bbae46001ee3e3fc31bffdf811d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 23 Feb 2024 18:36:48 +0100 Subject: [PATCH] release: Add _upload_versions_yaml_file() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the name says, this function will be used to upload the versions.yaml file during a given release process of the project. Signed-off-by: Fabiano FidĂȘncio --- .github/workflows/release.yaml | 11 +++-------- tools/packaging/release/release.sh | 10 ++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3ff8d72d49..1e41d4a545 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -123,15 +123,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: upload versions.yaml - env: - GITHUB_TOKEN: ${{ secrets.GIT_UPLOAD_TOKEN }} run: | - tag=$(echo $GITHUB_REF | cut -d/ -f3-) - pushd $GITHUB_WORKSPACE - versions_file="kata-containers-$tag-versions.yaml" - cp versions.yaml ${versions_file} - gh release upload "${tag}" "${versions_file}" - popd + ./tools/packaging/release/release.sh upload-versions-yaml-file + env: + GH_TOKEN: ${{ github.token }} upload-cargo-vendored-tarball: needs: upload-multi-arch-static-tarball diff --git a/tools/packaging/release/release.sh b/tools/packaging/release/release.sh index 21d3fab362..93cc410d58 100755 --- a/tools/packaging/release/release.sh +++ b/tools/packaging/release/release.sh @@ -74,6 +74,15 @@ function _upload_kata_static_tarball() gh release upload "${RELEASE_VERSION}" "${new_tarball_name}" } +function _upload_versions_yaml_file() +{ + [ -z "${RELEASE_VERSION}" ] && RELEASE_VERSION=$(cat "${repo_root_dir}/VERSION") + + versions_file="kata-containers-${RELEASE_VERSION}-versions.yaml" + cp "${repo_root_dir}/versions.yaml" ${versions_file} + gh release upload "${RELEASE_VERSION}" "${versions_file}" +} + function main() { action="${1:-}" @@ -81,6 +90,7 @@ function main() case "${action}" in publish-multiarch-manifest) _publish_multiarch_manifest ;; upload-kata-static-tarball) _upload_kata_static_tarball ;; + upload-versions-yaml-file) _upload_versions_yaml_file ;; *) >&2 _die "Invalid argument" ;; esac }