From ff5286a47da53374e3173e57f8826a5516189c00 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Fri, 31 Jan 2025 16:08:32 +0100 Subject: [PATCH] .github: Drop GitHub Action for updating go --- .github/workflows/go-apply-patch.sh | 74 ------------------- .../workflows/go-current-major-versions.sh | 30 -------- .github/workflows/go-release-main.yaml | 48 ------------ 3 files changed, 152 deletions(-) delete mode 100755 .github/workflows/go-apply-patch.sh delete mode 100755 .github/workflows/go-current-major-versions.sh delete mode 100644 .github/workflows/go-release-main.yaml diff --git a/.github/workflows/go-apply-patch.sh b/.github/workflows/go-apply-patch.sh deleted file mode 100755 index affdb3e3bd..0000000000 --- a/.github/workflows/go-apply-patch.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -source "${GHA_SCRIPTS_DIR}/.github/workflows/common.sh" - -prepare_git_repo - -# create a mapping between short version and new version, e.g. 1.16 -> 1.16.3 -declare -A VERSIONS -for version_new in ${VERSIONS_NEW}; do - version_new_trimmed="${version_new%.*}" - if [[ "${version_new_trimmed%.*}" = "${version_new_trimmed}" ]]; then - version_new_trimmed="${version_new}" - fi - VERSIONS["${version_new_trimmed}"]="${version_new}" -done - -branch_name="go-$(join_by '-and-' ${VERSIONS_NEW})-main" - -if ! check_remote_branch "${branch_name}"; then - echo "remote branch already exists, nothing to do" - exit 0 -fi - -# Parse the Manifest file for already present source files and keep the latest version in the current series -# DIST go1.17.src.tar.gz ... => 1.17 -# DIST go1.17.1.src.tar.gz ... => 1.17.1 -declare -a UPDATED_VERSIONS_OLD UPDATED_VERSIONS_NEW -any_different=0 -for version_short in "${!VERSIONS[@]}"; do - pushd "${SDK_OUTER_OVERLAY}" - VERSION_NEW="${VERSIONS["${version_short}"]}" - VERSION_OLD=$(sed -n "s/^DIST go\(${version_short}\(\.*[0-9]*\)\?\)\.src.*/\1/p" dev-lang/go/Manifest | sort -ruV | head -n1) - if [[ -z "${VERSION_OLD}" ]]; then - echo "${version_short} is not packaged, skipping" - popd - continue - fi - if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then - echo "${version_short} is already at the latest (${VERSION_NEW}), skipping" - popd - continue - fi - UPDATED_VERSIONS_OLD+=("${VERSION_OLD}") - UPDATED_VERSIONS_NEW+=("${VERSION_NEW}") - - any_different=1 - EBUILD_FILENAME=$(get_ebuild_filename dev-lang/go "${VERSION_OLD}") - git mv "${EBUILD_FILENAME}" "dev-lang/go/go-${VERSION_NEW}.ebuild" - - popd - - URL="https://go.dev/doc/devel/release#go${VERSION_NEW}" - - generate_update_changelog 'Go' "${VERSION_NEW}" "${URL}" 'go' - - commit_changes dev-lang/go "${VERSION_OLD}" "${VERSION_NEW}" -done - -cleanup_repo - -if [[ $any_different -eq 0 ]]; then - echo "go packages were already at the latest versions, nothing to do" - exit 0 -fi - -vo_gh="$(join_by ' and ' "${UPDATED_VERSIONS_OLD[@]}")" -vn_gh="$(join_by ' and ' "${UPDATED_VERSIONS_NEW[@]}")" - -echo "VERSIONS_OLD=${vo_gh}" >>"${GITHUB_OUTPUT}" -echo "VERSIONS_NEW=${vn_gh}" >>"${GITHUB_OUTPUT}" -echo "BRANCH_NAME=${branch_name}" >>"${GITHUB_OUTPUT}" -echo 'UPDATE_NEEDED=1' >>"${GITHUB_OUTPUT}" diff --git a/.github/workflows/go-current-major-versions.sh b/.github/workflows/go-current-major-versions.sh deleted file mode 100755 index d279161b76..0000000000 --- a/.github/workflows/go-current-major-versions.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -source "${GHA_SCRIPTS_DIR}/.github/workflows/common.sh" - -pushd "${SDK_OUTER_OVERLAY}" - -versions=() -for ebuild in dev-lang/go/go-*.ebuild; do - version="${ebuild##*/go-}" # 1.20.1-r1.ebuild or 1.19.ebuild - version="${version%.ebuild}" # 1.20.1-r1 or 1.19 - version="${version%%-*}" # 1.20.1 or 1.19 - short_version="${version%.*}" # 1.20 or 1 - if [[ "${short_version%.*}" = "${short_version}" ]]; then - # fix short version - short_version="${version}" - fi - - versions+=($(git ls-remote --tags https://github.com/golang/go | \ - cut -f2 | \ - sed --quiet "/refs\/tags\/go${short_version}\(\.[0-9]*\)\?$/s/^refs\/tags\/go//p" | \ - grep --extended-regexp --invert-match --regexp='(beta|rc)' | \ - sort --reverse --unique --version-sort | \ - head --lines=1)) -done - -popd - -echo "VERSIONS_NEW=${versions[*]}" >>"${GITHUB_OUTPUT}" diff --git a/.github/workflows/go-release-main.yaml b/.github/workflows/go-release-main.yaml deleted file mode 100644 index 3543cf25c1..0000000000 --- a/.github/workflows/go-release-main.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Get the latest Go release for main -on: - schedule: - - cron: '15 7 * * 1' - workflow_dispatch: - -jobs: - get-go-releases: - runs-on: ubuntu-latest - steps: - - name: Check out scripts - uses: actions/checkout@v4 - with: - token: ${{ secrets.BOT_PR_TOKEN }} - path: scripts - - name: Figure out latest Go release versions - id: go-latest-release - env: - GHA_SCRIPTS_DIR: "${{ github.workspace }}/scripts" - WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts" - run: scripts/.github/workflows/go-current-major-versions.sh - - 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" - VERSIONS_NEW: ${{ steps.go-latest-release.outputs.VERSIONS_NEW }} - PACKAGES_CONTAINER: ${{ steps.setup-flatcar-sdk.outputs.PACKAGES_CONTAINER }} - SDK_NAME: ${{ steps.setup-flatcar-sdk.outputs.SDK_NAME }} - TARGET_BRANCH: main - run: scripts/.github/workflows/go-apply-patch.sh - - name: Create pull request for main - uses: peter-evans/create-pull-request@v6 - if: steps.apply-patch-main.outputs.UPDATE_NEEDED == 1 - with: - token: ${{ secrets.BOT_PR_TOKEN }} - path: scripts - branch: ${{ steps.apply-patch-main.outputs.BRANCH_NAME }} - base: main - title: Upgrade Go from ${{ steps.apply-patch-main.outputs.VERSIONS_OLD }} to ${{ steps.apply-patch-main.outputs.VERSIONS_NEW }} - body: Subject says it all. - labels: main