#!/bin/bash # Copyright 2016 Iron.io # # Licensed 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 -ex user="iron" service="functions" version_file="api/server/version.go" tag="latest" if [ -z $(grep -m1 -Eo "[0-9]+\.[0-9]+\.[0-9]+" $version_file) ]; then echo "did not find semantic version in $version_file" exit 1 fi perl -i -pe 's/\d+\.\d+\.\K(\d+)/$1+1/e' $version_file version=$(grep -m1 -Eo "[0-9]+\.[0-9]+\.[0-9]+" $version_file) echo "Version: $version" make build-docker git add -u git commit -m "$service: $version release [skip ci]" git tag -a "$version" -m "version $version" git push git push --tags # Finally tag and push docker images docker tag $user/$service:$tag $user/$service:$version docker push $user/$service:$version docker push $user/$service:$tag