diff --git a/.github/workflows/vmware-apply-patch.sh b/.github/workflows/vmware-apply-patch.sh new file mode 100755 index 0000000000..b9b1585552 --- /dev/null +++ b/.github/workflows/vmware-apply-patch.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -euo pipefail + +source "${GHA_SCRIPTS_DIR}/.github/workflows/common.sh" + +prepare_git_repo + +# Update app-emulation/open-vm-tools + +pushd "${SDK_OUTER_OVERLAY}" + +# Parse the Manifest file for already present source files and keep the latest version in the current series +VERSION_OLD=$(sed -n "s/^DIST open-vm-tools-\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p" app-emulation/open-vm-tools/Manifest | sort -ruV | head -n1) +if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then + echo "already the latest open-vm-tools, nothing to do" + exit 0 +fi + +EBUILD_FILENAME_OVT=$(get_ebuild_filename app-emulation/open-vm-tools "${VERSION_OLD}") +git mv "${EBUILD_FILENAME_OVT}" "app-emulation/open-vm-tools/open-vm-tools-${VERSION_NEW}.ebuild" + +# We need to also replace the old build number with the new build number in the ebuild. +sed -i -e "s/^\(MY_P=.*-\)[0-9]*\"$/\1${BUILD_NUMBER}\"/" "app-emulation/open-vm-tools/open-vm-tools-${VERSION_NEW}.ebuild" + +# Also update coreos-base/oem-vmware +EBUILD_FILENAME_OEM=$(get_ebuild_filename coreos-base/oem-vmware "${VERSION_OLD}") +git mv "${EBUILD_FILENAME_OEM}" "coreos-base/oem-vmware/oem-vmware-${VERSION_NEW}.ebuild" + +popd + +URL="https://github.com/vmware/open-vm-tools/releases/tag/stable-${VERSION_NEW}" + +generate_update_changelog 'open-vm-tools' "${VERSION_NEW}" "${URL}" 'open-vm-tools' + +commit_changes app-emulation/open-vm-tools "${VERSION_OLD}" "${VERSION_NEW}" \ + coreos-base/oem-vmware + +cleanup_repo + +echo "VERSION_OLD=${VERSION_OLD}" >>"${GITHUB_OUTPUT}" +echo 'UPDATE_NEEDED=1' >>"${GITHUB_OUTPUT}" diff --git a/.github/workflows/vmware-release-main.yaml b/.github/workflows/vmware-release-main.yaml new file mode 100644 index 0000000000..03e6d6cd03 --- /dev/null +++ b/.github/workflows/vmware-release-main.yaml @@ -0,0 +1,49 @@ +name: Get the latest open-vm-tools release for main +on: + schedule: + - cron: '0 7 * * 3' + workflow_dispatch: + +jobs: + get-vmware-release: + runs-on: ubuntu-latest + steps: + - name: Check out scripts + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + path: scripts + - name: Figure out latest open-vm-tools release version + id: openvmtools-latest-release + run: | + version=$(git ls-remote --tags 'https://github.com/vmware/open-vm-tools' | cut -f2 | sed -n "/refs\/tags\/stable-[0-9]*\.[0-9]*\.[0-9]*$/s/^refs\/tags\/stable-//p" | sort -ruV | head -n1) + buildNumber=$(curl -sSL https://api.github.com/repos/vmware/open-vm-tools/releases/latest | jq -r '.assets[0].name' | sed -n "s/^open-vm-tools-${version}*-\([0-9]*\)\..*/\1/p") + echo "BUILD_NUMBER=${buildNumber}" >>"${GITHUB_OUTPUT}" + echo "VERSION_NEW=${version}" >>"${GITHUB_OUTPUT}" + - name: Set up Flatcar SDK + id: setup-flatcar-sdk + env: + WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts" + CHANNEL: main + run: scripts/.github/workflows/setup-flatcar-sdk.sh + - name: Apply patch for main + id: apply-patch-main + env: + GHA_SCRIPTS_DIR: "${{ github.workspace }}/scripts" + WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts" + BUILD_NUMBER: ${{ steps.openvmtools-latest-release.outputs.BUILD_NUMBER }} + VERSION_NEW: ${{ steps.openvmtools-latest-release.outputs.VERSION_NEW }} + PACKAGES_CONTAINER: ${{ steps.setup-flatcar-sdk.outputs.PACKAGES_CONTAINER }} + SDK_NAME: ${{ steps.setup-flatcar-sdk.outputs.SDK_NAME }} + run: scripts/.github/workflows/vmware-apply-patch.sh + - name: Create pull request for main + uses: peter-evans/create-pull-request@v5 + if: steps.apply-patch-main.outputs.UPDATE_NEEDED == 1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + path: scripts + branch: vmware-${{ steps.openvmtools-latest-release.outputs.VERSION_NEW }}-main + base: main + title: Upgrade open-vm-tools in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.openvmtools-latest-release.outputs.VERSION_NEW }} + body: Subject says it all. + labels: main