Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
(#65) v0.3.1:
Browse files Browse the repository at this point in the history
* (#59) Switch to the two-branches approach:
    * Adjust the workflows settings;
    * Update the description.

* (#61) Fix Publish Docker.

* (#63) Add Rclone, SSH daemon and few scripts:
    * Add Rclone;
    * Add scripts to help with setting up SSH and GPG keys;
    * Install ssh instead of openssh-client;
    * Run ssh daemon automatically;
    * Add keychain;
    * Extend description.
  • Loading branch information
Pavel Sobolev committed Jul 8, 2020
1 parent 904e918 commit 20c8cdf
Show file tree
Hide file tree
Showing 24 changed files with 414 additions and 236 deletions.
48 changes: 16 additions & 32 deletions .github/scripts/Build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,27 @@

# A script to build the image and test a container based on it

# Check for the branch (this is a fallback for the situation when
# Travis triggers a build for a base commit of a newly created branch,
# basically building the same image again, which is not necessary)
# Download dive
echo -e '\n\e[1;36mDownloading dive...\e[0m\n'
wget https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb

echo -e "\n\e[1m\033[36mCurrent branch: $TRAVIS_BRANCH\033[0m\n"
# Install dive
echo -e '\e[1;36mInstalling dive...\e[0m\n'
sudo apt install ./dive_0.9.2_linux_amd64.deb

if [ "$TRAVIS_BRANCH" != "master" ]; then

# Download dive
echo -e '\e[1m\033[36mDownloading dive...\033[0m\n'
wget https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb

# Install dive
echo -e '\e[1m\033[36mInstalling dive...\033[0m\n'
sudo apt install ./dive_0.9.2_linux_amd64.deb

# Activate experimental features
echo -e '\n\e[1m\033[36mActivating experimental features...\033[0m\n'
sudo tee /etc/docker/daemon.json > /dev/null << EOF
# Activate experimental features
echo -e '\n\e[1;36mActivating experimental features...\e[0m\n'
sudo tee /etc/docker/daemon.json > /dev/null << EOF
{
"experimental": true
}
EOF
sudo service docker restart

# Build the image
echo -e '\e[1m\033[36mBuilding the image...\033[0m\n'
docker build -t image --squash .

# Analyse the image
echo -e '\n\e[1m\033[36mAnalyzing the image...\033[0m\n'
CI=true dive image

else
sudo service docker restart

# Print info
echo -e '\e[1m\033[36mThis build was probably triggered by creating a new\033[0m'
echo -e '\e[1m\033[36mbranch, so there is no need to rebuild the image.\033[0m\n'
# Build the image
echo -e '\e[1;36mBuilding the image...\e[0m\n'
docker build -t image --squash .

fi
# Analyse the image
echo -e '\n\e[1;36mAnalyzing the image...\e[0m\n'
CI=true dive image
12 changes: 6 additions & 6 deletions .github/scripts/PublishDocker.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ if [ ! -z "$LAST_VERSION" ]; then
CURRENT_TAG=$(echo ${GITHUB_REF#refs/*/})

# Print info
echo -e "\n\e[1m\033[36mLast version: $LAST_VERSION\033[0m"
echo -e "\e[1m\033[36mCurrent tag: $CURRENT_TAG\033[0m\n"
echo -e "\n\e[1;36mLast version: $LAST_VERSION\e[0m"
echo -e "\e[1;36mCurrent tag: $CURRENT_TAG\e[0m\n"

# Check if the tag is a semantic version
if echo "$CURRENT_TAG" | grep -q "v[0-9]*.[0-9]*.[0-9]*"; then
if echo "$CURRENT_TAG" | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$"; then

# Print information
echo -e "\e[1m\033[36mCurrent tag is a semantic version. Tagged image will be published.\033[0m\n"
echo -e "\e[1;36mCurrent tag is a semantic version. Tagged image will be published.\e[0m\n"

# Set environment variable
echo ::set-env name=RELEASE_VERSION::$(echo ${CURRENT_TAG} | sed 's/v//')
Expand All @@ -33,7 +33,7 @@ if [ ! -z "$LAST_VERSION" ]; then
else

# Print information
echo -e "\e[1m\033[36mCurrent tag is not a semantic version. Tagged image will not be published.\033[0m\n"
echo -e "\e[1;36mCurrent tag is not a semantic version. Tagged image will not be published.\e[0m\n"

# Don't publish tagged image
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo false)
Expand All @@ -43,7 +43,7 @@ if [ ! -z "$LAST_VERSION" ]; then
else

# Print information
echo -e "\n\e[1m\033[36mNo release has been found, tagged version will not be published.\033[0m\n"
echo -e "\n\e[1;36mNo release has been found, tagged version will not be published.\e[0m\n"

# Don't publish tagged image
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo false)
Expand Down
130 changes: 57 additions & 73 deletions .github/scripts/VersionCheck.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,116 +3,100 @@
# A script to check whether current version differs from
# the previous one and is consistent throughout the project

# Check for the branch (this is a fallback for the situation when
# Travis triggers a build for a base commit of a newly created branch,
# basically checking the version again, which is not necessary)
# Define error variable
ERROR_COUNT=0

echo -e "\n\e[1m\033[36mCurrent branch: $TRAVIS_BRANCH\033[0m\n"
# Check version
function check_readme_versions {

if [ "$TRAVIS_BRANCH" != "master" ]; then
echo -e "\e[1;36mChecking versions in \"$1\"...\e[0m"

# Define error variable
ERROR_COUNT=0
if [ $(grep "docker pull paveloom/dev" README.md | grep -o ":.*" | sed 's/\://') == "$LOCAL_VERSION" ]; then

# Check version
function check_readme_versions {
echo -e "\e[1;36m> The version in the first download line is relevant.\e[0m"

echo -e "\e[1m\033[36mChecking versions in \"$1\"...\033[0m"

if [ $(grep "docker pull paveloom/dev" README.md | grep -o ":.*" | sed 's/\://') == "$LOCAL_VERSION" ]; then

echo -e "\e[1m\033[36m> The version in the first download line is relevant.\033[0m"

else

echo -e "\e[1m\033[31m> The version in the first download line is not relevant.\033[0m"
ERROR_COUNT=$((ERROR_COUNT+1))

fi

if [ $(grep "docker pull docker.pkg.github.com/paveloom-d/dev/dev:" README.md | grep -o ":.*" | sed 's/\://') == "$LOCAL_VERSION" ]; then
else

echo -e "\e[1m\033[36m> The version in the second download line is relevant.\033[0m"
echo -e "\e[1;31m> The version in the first download line is not relevant.\e[0m"
ERROR_COUNT=$((ERROR_COUNT+1))

else
fi

echo -e "\e[1m\033[31m> The version in the second download line is not relevant.\033[0m"
ERROR_COUNT=$((ERROR_COUNT+1))
if [ $(grep "docker pull docker.pkg.github.com/paveloom-d/dev/dev:" README.md | grep -o ":.*" | sed 's/\://') == "$LOCAL_VERSION" ]; then

fi
echo -e "\e[1;36m> The version in the second download line is relevant.\e[0m"

echo
else

}
echo -e "\e[1;31m> The version in the second download line is not relevant.\e[0m"
ERROR_COUNT=$((ERROR_COUNT+1))

# Run all checks
function run_version_checks {
fi

check_readme_versions "README.md"
echo

}
}

# Get the version of the last release
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Run all checks
function run_version_checks {

# Get the last version tag of the repository
# (assuming a GitHub release was created
# and Semantic Versioning was respected)
LAST_VERSION=$(get_latest_release "paveloom-d/dev")
check_readme_versions "README.md"

# Check if there is some tag
if [ ! -z "$LAST_VERSION" ]; then
}

# Escape last version
ESCAPED_LAST_VERSION="$(echo "$LAST_VERSION" | sed 's/v//')"
# Get the version of the last release
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}

# Get the local version
LOCAL_VERSION=$(grep "LABEL version=" Dockerfile | grep -o "\".*\"" | sed 's/\"//g')
# Get the last version tag of the repository
# (assuming a GitHub release was created
# and Semantic Versioning was respected)
LAST_VERSION=$(get_latest_release "paveloom-d/dev")

# Print version
echo -e "\e[1m\033[36mLast version: $ESCAPED_LAST_VERSION\033[0m"
echo -e "\e[1m\033[36mLocal version: $LOCAL_VERSION\033[0m\n"
# Check if there is some tag
if [ ! -z "$LAST_VERSION" ]; then

# Check whether local version differs from the last one
if [ $LOCAL_VERSION == $ESCAPED_LAST_VERSION ]; then
# Escape last version
ESCAPED_LAST_VERSION="$(echo "$LAST_VERSION" | sed 's/v//')"

echo -e "\e[1m\033[31mLocal version and the last version are identical. Consider\033[0m"
echo -e "\e[1m\033[31msuggesting a new version according to Semantic Versioning.\n\033[0m"
# Get the local version
LOCAL_VERSION=$(grep "LABEL version=" Dockerfile | grep -o "\".*\"" | sed 's/\"//g')

exit 1
# Print version
echo -e "\e[1;36mLast version: $ESCAPED_LAST_VERSION\e[0m"
echo -e "\e[1;36mLocal version: $LOCAL_VERSION\e[0m\n"

fi
# Check whether local version differs from the last one
if [ $LOCAL_VERSION == $ESCAPED_LAST_VERSION ]; then

# Check consistency
run_version_checks
echo -e "\e[1;31mLocal version and the last version are identical. Consider\e[0m"
echo -e "\e[1;31msuggesting a new version according to Semantic Versioning.\n\e[0m"

# Print the number of consistency errors
if [ "$ERROR_COUNT" -gt 0 ]; then
exit 1

echo -e "\e[1m\033[31mSome consistency errors have been found ($ERROR_COUNT)\033[0m\n"
exit 1
fi

else
# Check consistency
run_version_checks

echo -e "\e[1m\033[36mNo consistency errors.\033[0m\n"
# Print the number of consistency errors
if [ "$ERROR_COUNT" -gt 0 ]; then

fi
echo -e "\e[1;31mSome consistency errors have been found ($ERROR_COUNT)\e[0m\n"
exit 1

else

# Print information
echo -e "\e[1m\033[36mNo release has been found, version checking will be omitted.\033[0m\n"
echo -e "\e[1;36mNo consistency errors.\e[0m\n"

fi

else

# Print info
echo -e '\e[1m\033[36mThis build was probably triggered by creating a new\033[0m'
echo -e '\e[1m\033[36mbranch, so there is no need to check the version again.\033[0m\n'
# Print information
echo -e "\e[1;36mNo release has been found, version checking will be omitted.\e[0m\n"

fi
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [published]
push:
branches:
- master
- develop

jobs:
update:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release Drafter
on:
push:
branches:
- master
- develop

jobs:
update:
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ os:
branches:
except:
- master
- develop
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/

services:
Expand Down
Loading

0 comments on commit 20c8cdf

Please sign in to comment.