From f4a83a15609daae72bab8dce7ac5faaf56841c8c Mon Sep 17 00:00:00 2001 From: kz6fittycent Date: Sat, 16 Dec 2023 11:38:58 -0600 Subject: [PATCH 1/3] reverted to correct logic I should have stuck with the original logic instead of accepting some proposed changes. I should have explained why the logic was the way I wrote it and also thought thru what was being proposed as an alternative before accepting the proposed change. This will be the way going forward. --- .github/workflows/sync-version-with-upstream.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-version-with-upstream.yml b/.github/workflows/sync-version-with-upstream.yml index c98dee4..84c0515 100644 --- a/.github/workflows/sync-version-with-upstream.yml +++ b/.github/workflows/sync-version-with-upstream.yml @@ -23,11 +23,13 @@ jobs: token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }} update-script: | #!/bin/bash - # Update the snapcraft.yaml to match upstream version API="https://api.github.com/repos/jenkinsci/jenkins/releases/latest" VERSION=$(curl -s "${API}" | grep -i name | awk 'FNR == 3 {print $2}' | cut -d ',' -f1 | sed 's/"//g') CRAFT=$(grep -i version snap/snapcraft.yaml | awk '{print $2}' | sed 's/"//g') - # Running checks here - if [[ "${CRAFT}" < "${VERSION}" ]]; then + # Running checks here to ensure that the version from upstream is actually a greater value than what is shown in the snapcraft.yaml + if [[ "${CRAFT}" > "${VERSION}" ]] + then + exit + else sed -i 's/^\(version: \).*$/\1'"'$VERSION'"'/' snap/snapcraft.yaml fi From 3309a70063a8cd8dbcaa83f6e84e09875de93b0a Mon Sep 17 00:00:00 2001 From: kz6fittycent Date: Sat, 16 Dec 2023 13:13:19 -0600 Subject: [PATCH 2/3] Just forcing a change to the yaml This needs to be set to a lower number to ensure the next build triggers as part of this PR. --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ec29d82..c8ba87a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -13,7 +13,7 @@ issues: https://github.com/snapcrafters/jenkins/issues source-code: https://github.com//snapcrafters/jenkins license: MIT icon: snap/local/jenkins.png -version: '2.436' +version: '2.435' base: core22 confinement: classic From d61baeee5b3261dadef5e0c74ed2ce49895f5627 Mon Sep 17 00:00:00 2001 From: kz6fittycent Date: Sat, 16 Dec 2023 17:24:18 -0600 Subject: [PATCH 3/3] Updated logic per Merlijn's method It's working locally - let's rock. --- .github/workflows/sync-version-with-upstream.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sync-version-with-upstream.yml b/.github/workflows/sync-version-with-upstream.yml index 84c0515..a37bc77 100644 --- a/.github/workflows/sync-version-with-upstream.yml +++ b/.github/workflows/sync-version-with-upstream.yml @@ -22,14 +22,6 @@ jobs: with: token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }} update-script: | - #!/bin/bash - API="https://api.github.com/repos/jenkinsci/jenkins/releases/latest" - VERSION=$(curl -s "${API}" | grep -i name | awk 'FNR == 3 {print $2}' | cut -d ',' -f1 | sed 's/"//g') - CRAFT=$(grep -i version snap/snapcraft.yaml | awk '{print $2}' | sed 's/"//g') - # Running checks here to ensure that the version from upstream is actually a greater value than what is shown in the snapcraft.yaml - if [[ "${CRAFT}" > "${VERSION}" ]] - then - exit - else - sed -i 's/^\(version: \).*$/\1'"'$VERSION'"'/' snap/snapcraft.yaml - fi + # Grabbing latest release + VERSION=$(curl -sL https://api.github.com/repos/jenkinsci/jenkins/releases | jq .[].tag_name -r | grep -v rc | sort -r | head -n 1 | cut -d "-" -f2) + sed -i 's/^\(version: \).*$/\1'"'$VERSION'"'/' snap/snapcraft.yaml