You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2022/12/16 09:00:53 UTC

[camel-k] 01/03: feat: automatic github actions bump

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit b897739d324c7a25a83de44f19264f83da178ce4
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Dec 15 16:52:29 2022 +0100

    feat: automatic github actions bump
    
    Closes #3910
---
 .github/workflows/release.yml |  4 ++--
 script/Makefile               |  1 +
 script/bump_actions.sh        | 45 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 477349a3a..125670859 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -45,7 +45,7 @@ jobs:
     if: github.repository == 'apache/camel-k'
     runs-on: ubuntu-20.04
     steps:
-    - name: Release 1.10 nightly
+    - name: release-1.10.x nightly
       uses: ./.github/actions/release-nightly
       with:
         branch-ref: "release-1.10.x"
@@ -61,7 +61,7 @@ jobs:
     if: github.repository == 'apache/camel-k'
     runs-on: ubuntu-20.04
     steps:
-    - name: Release 1.8 nightly
+    - name: release-1.8.x nightly
       uses: ./.github/actions/release-nightly
       with:
         branch-ref: "release-1.8.x"
diff --git a/script/Makefile b/script/Makefile
index 2605d6e6f..a93926aab 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -140,6 +140,7 @@ bump-replace:
 	@sed -i 's/^LAST_RELEASED_VERSION ?= .*$//LAST_RELEASED_VERSION ?= $(LAST_RELEASED_VERSION)/' ./script/Makefile
 
 bump: bump-replace codegen bundle
+	./script/bump_actions.sh $(LAST_RELEASED_VERSION)
 
 # Generates the version file
 codegen:
diff --git a/script/bump_actions.sh b/script/bump_actions.sh
new file mode 100755
index 000000000..77cf87d23
--- /dev/null
+++ b/script/bump_actions.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ "$#" -lt 1 ]; then
+  echo "usage: $0 <Camel K version>"
+  exit 1
+fi
+
+location=$(dirname $0)
+version="$1"
+
+re="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
+if ! [[ $version =~ $re ]]; then
+    echo "❗ argument must match semantic version: $version"
+    exit 1
+fi
+version_mm="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
+
+new_release="v$(echo "$version_mm" | tr \. _)_x"
+new_release_branch="release-$version_mm.x"
+
+# pick the oldest release (we will replace it)
+oldest_release=$(yq '.jobs[] | key | select ( . !="main" )' $location/../.github/workflows/release.yml | sort | head -1)
+oldest_release_branch=$(yq ".jobs[\"$oldest_release\"].steps[0].with.branch-ref" $location/../.github/workflows/release.yml)
+echo "Swapping GH actions tasks from $oldest_release to $new_release, $oldest_release_branch to $new_release_branch"
+# Nightly release action
+sed -i "s/$oldest_release/$new_release/g" $location/../.github/workflows/release.yml
+sed -i "s/$oldest_release_branch/$new_release_branch/g" $location/../.github/workflows/release.yml
+# Automatic updates action
+sed -i "s/$oldest_release/$new_release/g" $location/../.github/workflows/automatic-updates.yml
+sed -i "s/$oldest_release_branch/$new_release_branch/g" $location/../.github/workflows/automatic-updates.yml
\ No newline at end of file