-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/skalenetwork/skale-proxy …
…into develop
- Loading branch information
Showing
7 changed files
with
212 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Build and push skale-proxy container | ||
on: | ||
workflow_dispatch: | ||
push: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
steps: | ||
- name: Login to docker | ||
run: docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} | ||
- uses: actions/checkout@v1 | ||
- name: submodule update | ||
run: git submodule update --init --recursive | ||
- name: build and deploy test image | ||
run: python3 scripts/docker_build.py Dockerfile skale-proxy ${GITHUB_SHA} | ||
- name: deploy docker image | ||
if: | | ||
contains(github.ref, 'develop') || contains(github.ref, 'beta') || | ||
contains(github.ref, 'master') | ||
run : | | ||
export BRANCH=${GITHUB_REF##*/} | ||
echo "Branch $BRANCH" | ||
export VERSION=$(cat VERSION) | ||
echo "Version $VERSION" | ||
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION) | ||
echo "::set-env name=VERSION::$VERSION" | ||
echo "Version $VERSION" | ||
export RELEASE=true | ||
echo "::set-env name=RELEASE::$RELEASE" | ||
bash ./scripts/build_image.sh Dockerfile skale-proxy | ||
bash ./scripts/publish_image.sh skale-proxy | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
- name: Create Release | ||
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
release_name: ${{ env.VERSION }} | ||
draft: false | ||
prerelease: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.77.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
|
||
DOCKERFILE=$1 | ||
CONTAINER_NAME=$2 | ||
|
||
: "${VERSION?Need to set VERSION}" | ||
: "${BRANCH?Need to set BRANCH}" | ||
|
||
REPO_NAME=skalenetwork/$CONTAINER_NAME | ||
IMAGE_NAME=$REPO_NAME:$VERSION | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# Build image | ||
|
||
echo "Building $IMAGE_NAME..." | ||
docker build -f "${DIR}"/../"${DOCKERFILE}" -t "${IMAGE_NAME}" . || exit $? | ||
|
||
if [ "${BRANCH}" = "stable" ]; | ||
then | ||
LATEST_IMAGE_NAME=$REPO_NAME:latest | ||
docker tag "${IMAGE_NAME}" "${LATEST_IMAGE_NAME}" | ||
else | ||
LATEST_IMAGE_NAME=$REPO_NAME:$BRANCH-latest | ||
docker tag "${IMAGE_NAME}" "${LATEST_IMAGE_NAME}" | ||
fi | ||
|
||
echo "=========================================================================================" | ||
echo "Built $IMAGE_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
BRANCH=$1 | ||
VERSION=$2 | ||
|
||
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 | ||
|
||
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="$VERSION-$LABEL.$VERSION_NUMBER" | ||
if ! [[ $(git tag -l | grep $RESULT_VERSION) ]]; then | ||
echo "$RESULT_VERSION" | tr / - | ||
break | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
|
||
# 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_build.py | ||
# @author Stan Kladko | ||
# @date 2020 | ||
# | ||
|
||
import sys, os, subprocess, time | ||
|
||
os.chdir("..") | ||
topDir = os.getcwd() + "/skale-proxy" | ||
DOCKER_FILE_NAME = sys.argv[1] | ||
IMAGE_NAME = sys.argv[2] | ||
COMMIT_HASH = sys.argv[3] | ||
|
||
FULL_IMAGE_TAG = "skalenetwork/" + IMAGE_NAME + ":" + COMMIT_HASH | ||
|
||
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 | ||
|
||
assert subprocess.call(["docker", "push", FULL_IMAGE_TAG]) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
|
||
CONTAINER_NAME=$1 | ||
|
||
: "${VERSION?Need to set VERSION}" | ||
: "${BRANCH?Need to set BRANCH}" | ||
|
||
REPO_NAME=skalenetwork/$CONTAINER_NAME | ||
IMAGE_NAME=$REPO_NAME:$VERSION | ||
|
||
LATEST_IMAGE_NAME=$REPO_NAME:$BRANCH-latest | ||
docker tag "${IMAGE_NAME}" "${LATEST_IMAGE_NAME}" | ||
|
||
: "${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 $? |