Unverified Commit e86abd44 authored by Stan Kladko's avatar Stan Kladko Committed by GitHub

Merge pull request #84 from skalenetwork/feature/SKALE-2202-versioning

SKALE-2202 versioning
parents 2e6e8f91 5607654f
......@@ -12,8 +12,18 @@ jobs:
- name: submodule update
run: git submodule update --init --recursive
- name: build
run: python3 scripts/docker_build.py ${GITHUB_REF##*/} Dockerfile sgxwallet ${GITHUB_SHA}
- name: push
run: python3 scripts/docker_push.py ${GITHUB_REF##*/} Dockerfile sgxwallet ${GITHUB_SHA}
run: python3 scripts/docker_build.py Dockerfile sgxwallet ${GITHUB_SHA}
- name: deploy docker image
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run : |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(cat SGXWALLET_VERSION)
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION sgxwallet)
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
export RELEASE=true
echo "::set-env name=RELEASE::$RELEASE"
bash ./scripts/build_and_publish.sh sgxwallet Dockerfile
......@@ -15,7 +15,16 @@ jobs:
- name: submodule update
run: git submodule update --init --recursive
- name: Build the Docker image
run: docker build . --file DockerfileBase --tag skalenetwork/sgxwallet_base:latest
- name: push docker image
run: docker push skalenetwork/sgxwallet_base:latest
run: docker build . --file DockerfileBase --tag skalenetwork/sgxwallet_base:latest
- name: deploy docker image
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run : |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(cat SGXWALLET_VERSION)
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION sgxwallet_base)
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
export RELEASE=true
echo "::set-env name=RELEASE::$RELEASE"
bash ./scripts/build_and_publish.sh sgxwallet_base DockerfileBase
\ No newline at end of file
......@@ -14,12 +14,35 @@ jobs:
- name: submodule update
run: git submodule update --init --recursive
- name: build
run: python3 scripts/docker_build.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
run: python3 scripts/docker_build.py DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
- name: test
run: python3 scripts/docker_test.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
- name: push
run: python3 scripts/docker_push.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
run: python3 scripts/docker_test.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim
- name: deploy docker image
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run : |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(cat SGXWALLET_VERSION)
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION sgxwalletsim)
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
export RELEASE=true
echo "::set-env name=RELEASE::$RELEASE"
bash ./scripts/build_and_publish.sh sgxwalletsim DockerfileSimulation
- name: Create Release
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: true
#!/usr/bin/env bash
set -e
CONTAINER=$1
DOCKERFILE=$2
: "${VERSION?Need to set VERSION}"
: "${BRANCH?Need to set BRANCH}"
NAME=schain
REPO_NAME=skalenetwork/$NAME
IMAGE_NAME=$REPO_NAME:$CONTAINER:$VERSION
LATEST_IMAGE_NAME=$REPO_NAME:$CONTAINER:$BRANCH-latest
# Build image
echo "Building $IMAGE_NAME..."
docker build -t "$IMAGE_NAME" --file "$DOCKERFILE" || exit $?
docker tag "$IMAGE_NAME" "$LATEST_IMAGE_NAME"
echo "========================================================================================="
echo "Built $IMAGE_NAME"
# Publish image
: "${DOCKER_USERNAME?Need to set DOCKER_USERNAME}"
: "${DOCKER_PASSWORD?Need to set DOCKER_PASSWORD}"
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
docker push "$IMAGE_NAME" || exit $?
docker push "$LATEST_IMAGE_NAME" || exit $?
#!/bin/bash
BRANCH=$1
VERSION=$2
CONTAINER=$3
if [ -z "$BRANCH" ]
then
echo "A branch is not set."
exit 1
fi
if [ -z "$VERSION" ]
then
echo "The base version is not set."
exit 1
fi
if [ -z "$CONTAINER" ]
then
echo "The base container is not set."
exit 1
fi
git fetch --tags
if [ "$BRANCH" = "master" ]
then
echo "$VERSION"
exit 0
fi
LABEL="develop"
if [ "$BRANCH" = "stable" ]
then
LABEL="stable"
elif [ "$BRANCH" = "beta" ]
then
LABEL="beta"
fi
for (( VERSION_NUMBER=0; ; VERSION_NUMBER++ ))
do
RESULT_VERSION="$CONTAINER:$VERSION-$LABEL.$VERSION_NUMBER"
if ! [ $(git tag -l ?$RESULT_VERSION) ]
then
echo "$RESULT_VERSION"
break
fi
done
......@@ -50,24 +50,17 @@ import sys, os, subprocess, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
BRANCH = sys.argv[1]
DOCKER_FILE_NAME = sys.argv[2]
IMAGE_NAME = sys.argv[3]
COMMIT_HASH = sys.argv[4]
if (BRANCH == "develop"):
TAG_POSTFIX = "latest"
else:
TAG_POSTFIX = "latest_commit"
DOCKER_FILE_NAME = sys.argv[1]
IMAGE_NAME = sys.argv[2]
COMMIT_HASH = sys.argv[3]
TAG_POSTFIX = "latest_commit"
FULL_IMAGE_TAG = "skalenetwork/" + IMAGE_NAME + ":" + TAG_POSTFIX
COMMIT_HASH_TAG = "skalenetwork/" + IMAGE_NAME + ":" + COMMIT_HASH
print("Starting build for branch " + BRANCH, flush=True)
print("Starting build", flush=True)
assert subprocess.call(["pwd"]) == 0
assert subprocess.call(["docker", "build", topDir, "--file", topDir + "/" + DOCKER_FILE_NAME, "--tag",
FULL_IMAGE_TAG]) == 0
if (BRANCH == "develop"):
assert subprocess.call(["docker", "tag", FULL_IMAGE_TAG, COMMIT_HASH_TAG]) == 0
FULL_IMAGE_TAG]) == 0
\ No newline at end of file
#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Bash script to build cpp-ethereum within TravisCI.
#
# The documentation for cpp-ethereum is hosted at http://cpp-ethereum.org
#
# ------------------------------------------------------------------------------
# This file is part of cpp-ethereum.
#
# cpp-ethereum is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cpp-ethereum is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>
#
# (c) 2016 cpp-ethereum contributors.
# ------------------------------------------------------------------------------
#
# Copyright (C) 2019-Present SKALE Labs
#
# This file is part of sgxwallet.
#
# sgxwallet is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# sgxwallet is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with sgxwallet. If not, see <https://www.gnu.org/licenses/>.
#
# @file docker_push.py
# @author Stan Kladko
# @date 2020
#
import sys, os, subprocess, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
print("Starting build push")
print("Top directory is:" + topDir)
SCRIPTS_DIR = topDir + "/scripts"
BRANCH = sys.argv[1];
DOCKER_FILE_NAME = sys.argv[2];
IMAGE_NAME = sys.argv[3];
COMMIT_HASH = sys.argv[4]
if (BRANCH == "develop") :
TAG_POSTFIX = "latest";
else :
TAG_POSTFIX = "latest_commit"
FULL_IMAGE_NAME = "skalenetwork/" + IMAGE_NAME +":" + TAG_POSTFIX;
assert subprocess.call(["docker", "push", "skalenetwork/" + IMAGE_NAME]) == 0;
......@@ -24,21 +24,14 @@
import sys, os, subprocess, socket, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
print("Starting container test")
print("Top directory is:" + topDir)
SCRIPTS_DIR = topDir + "/scripts"
BRANCH = sys.argv[1];
DOCKER_FILE_NAME = sys.argv[2];
IMAGE_NAME = sys.argv[3];
COMMIT_HASH = sys.argv[4]
IMAGE_NAME = sys.argv[3]
if (BRANCH == "develop") :
TAG_POSTFIX = "latest";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment