Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 561900c

Browse files
committed
change install version script and add check in release workflow to check version being published
1 parent a963d7b commit 561900c

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

.github/workflows/release.yml

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ jobs:
1515
uses: actions/checkout@v2
1616
with:
1717
fetch-depth: 0
18+
-
19+
name: Check plugin and script version
20+
uses: mikefarah/[email protected]
21+
with:
22+
cmd: ./scripts/check_version.sh plugin.yaml scripts/install_version.sh ${{ github.ref }}
1823
-
1924
name: Set up Go
2025
uses: actions/setup-go@v2

scripts/check_version.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
3+
# Checks plugin.yaml version and also the install version script version
4+
5+
set -e
6+
7+
plugin_yaml=$1
8+
# example: refs/tags/0.0.1
9+
install_version_script=$2
10+
refTag=$3
11+
expected_version=$(echo $refTag | cut -d "/" -f 3)
12+
13+
if [ -z $expected_version ];
14+
then
15+
echo "git tag value is empty"
16+
exit 1
17+
fi
18+
19+
if [ ! -e $plugin_yaml ];
20+
then
21+
echo "File $plugin_yaml does not exist!"
22+
exit 1
23+
fi
24+
25+
plugin_version=$(yq read $plugin_yaml version)
26+
27+
if [ "$plugin_version" != "$expected_version" ];
28+
then
29+
echo "Plugin version $plugin_version is not the expected version $expected_version"
30+
exit 1
31+
fi
32+
33+
if [ ! -e $install_version_script ];
34+
then
35+
echo "File $install_version_script does not exist!"
36+
exit 1
37+
fi
38+
39+
set +e
40+
41+
grep -q -F $expected_version $install_version_script
42+
wrong_version=$?
43+
44+
set -e
45+
46+
if [ $wrong_version != 0 ];
47+
then
48+
echo "$install_version_script does not have the right version"
49+
exit 1
50+
fi

scripts/install_version.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
## version of the plugin mentioned
88
## in the plugin.yaml
99

10-
version="$(cat plugin.yaml | grep "version:" | cut -d '"' -f 2)"
11-
./scripts/install.sh $version
10+
./scripts/install.sh "0.0.3"

0 commit comments

Comments
 (0)