Skip to content

Commit

Permalink
Fix #1601: add v prefix to future tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Jul 14, 2020
1 parent ff29575 commit ad275d9
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 15 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
${{ runner.os }}-go-
- name: Prerequisites
run: |
export OPERATOR_SDK_VERSION=v0.15.2
export OPERATOR_SDK_VERSION=v0.17.1
curl -L https://github.com/operator-framework/operator-sdk/releases/download/v0.15.2/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu -o operator-sdk
chmod a+x operator-sdk
sudo mv operator-sdk /usr/local/bin
Expand All @@ -55,7 +55,8 @@ jobs:
TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
run: |
VERSION=${GITHUB_REF##*/}
TAG=${GITHUB_REF##*/}
VERSION=${TAG:1}
echo "Using VERSION=$VERSION"
echo "::set-env name=VERSION::$VERSION"
Expand Down
11 changes: 7 additions & 4 deletions script/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ images-push-staging:
set-version:
./script/set_version.sh $(VERSION) $(IMAGE_NAME)

set-module-version:
./script/set_go_modules_version.sh $(VERSION)

git-tag:
./script/git_tag.sh $(VERSION) $(RELEASE_GIT_REMOTE)

Expand All @@ -233,11 +236,11 @@ package-artifacts:
unsnapshot-olm:
./script/unsnapshot_olm.sh

release: clean codegen set-version build-resources check-licenses unsnapshot-olm build images images-push cross-compile package-examples git-tag
release: clean codegen set-module-version set-version build-resources check-licenses unsnapshot-olm build images images-push cross-compile package-examples git-tag

release-staging: clean codegen set-version build-resources check-licenses unsnapshot-olm build images images-push-staging cross-compile package-examples git-tag
release-staging: clean codegen set-module-version set-version build-resources check-licenses unsnapshot-olm build images images-push-staging cross-compile package-examples git-tag

release-nightly: clean codegen set-version build-resources build images images-push cross-compile package-examples
release-nightly: clean codegen set-module-version set-version build-resources build images images-push cross-compile package-examples

release-helm:
./script/release_helm.sh
Expand All @@ -258,4 +261,4 @@ get-staging-repo:
get-version:
@echo $(VERSION)

.PHONY: build build-kamel build-resources build-olm unsnapshot-olm dep codegen images images-dev images-push images-push-staging test check test-integration clean release cross-compile package-examples set-version git-tag release-notes check-licenses generate-deepcopy generate-client generate-doc build-resources release-helm release-staging release-nightly get-staging-repo get-version build-submodules
.PHONY: build build-kamel build-resources build-olm unsnapshot-olm dep codegen images images-dev images-push images-push-staging test check test-integration clean release cross-compile package-examples set-version git-tag release-notes check-licenses generate-deepcopy generate-client generate-doc build-resources release-helm release-staging release-nightly get-staging-repo get-version build-submodules set-module-version
16 changes: 9 additions & 7 deletions script/git_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@
set -e

if [ "$#" -ne 2 ]; then
echo "usage: $0 version branch"
echo "usage: $0 version remote"
exit 1
fi

location=$(dirname $0)
target_version=$1
target_branch=$2
target_tag=v$target_version
target_staging=staging-$target_tag
target_remote=$2

git branch -D staging-${target_version} || true
git checkout -b staging-${target_version}
git branch -D ${target_staging} || true
git checkout -b ${target_staging}
git add * || true
git commit -a -m "Release ${target_version}"
git tag --force ${target_version} staging-${target_version}
git push --force ${target_branch} ${target_version}
git tag --force ${target_tag} ${target_staging}
git push --force ${target_remote} ${target_tag}

echo "Tag ${target_version} pushed ${target_branch}"
echo "Tag ${target_tag} pushed ${target_remote}"
35 changes: 35 additions & 0 deletions script/set_go_modules_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

# 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.

set -e

if [ "$#" -ne 1 ]; then
echo "usage: $0 version"
exit 1
fi

location=$(dirname $0)
target_version=$1
target_tag=v$target_version

api_rule="s/github.com\/apache\/camel-k\/pkg\/apis\/camel [A-Za-z0-9\.\-]+.*$/github.com\/apache\/camel-k\/pkg\/apis\/camel $target_tag/"
client_rule="s/github.com\/apache\/camel-k\/pkg\/client\/camel [A-Za-z0-9\.\-]+.*$/github.com\/apache\/camel-k\/pkg\/client\/camel $target_tag/"

sed -i -r "$api_rule" $location/../go.mod
sed -i -r "$client_rule" $location/../go.mod

sed -i -r "$api_rule" $location/../pkg/client/camel/go.mod
4 changes: 2 additions & 2 deletions script/trigger_nightly_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# limitations under the License.

V=$(make get-version | sed s/-SNAPSHOT/-nightly.$(date +%Y%m%d%H%M)/)
git tag $V
git push upstream $V
git tag v$V
git push upstream v$V

0 comments on commit ad275d9

Please sign in to comment.