This repository has been archived by the owner on Apr 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pavel Sobolev
committed
Jun 30, 2020
1 parent
3ff1b7f
commit 8169cec
Showing
3 changed files
with
67 additions
and
5 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,51 @@ | ||
#!/bin/bash | ||
|
||
# A script to decide what version to upload | ||
|
||
# Set current repository variable | ||
REPOSITORY=paveloom-d/dev | ||
|
||
# Get last published version | ||
LAST_VERSION=$(curl --silent "https://api.github.com/repos/$REPOSITORY/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
||
# Check if there is some tag | ||
if [ ! -z "$LAST_VERSION" ]; then | ||
|
||
# Get current tag | ||
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" | ||
|
||
# Check if the tag is a semantic version | ||
if echo "$CURRENT_TAG" | grep -q "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" | ||
|
||
# Set environment variable | ||
echo ::set-env name=RELEASE_VERSION::$(echo ${CURRENT_TAG} | sed 's/v//') | ||
|
||
# Publish tagged image | ||
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo true) | ||
|
||
else | ||
|
||
# Print information | ||
echo -e "\e[1m\033[36mCurrent tag is not a semantic version. Tagged image will not be published.\033[0m\n" | ||
|
||
# Don't publish tagged image | ||
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo false) | ||
|
||
fi | ||
|
||
else | ||
|
||
# Print information | ||
echo -e "\n\e[1m\033[36mNo release has been found, tagged version will not be published.\033[0m\n" | ||
|
||
# Don't publish tagged image | ||
echo ::set-env name=PUBLISH_RELEASE_VERSION::$(echo false) | ||
|
||
fi |
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