Skip to content

Commit

Permalink
Fix versioning in GH actions (#16)
Browse files Browse the repository at this point in the history
Replace git shortlog with rev-list
  • Loading branch information
NotAProton authored Sep 12, 2021
1 parent 56fd13d commit e9655d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions scripts/chromium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ bash ./scripts/copy_common.sh $DES
cp platform_spec/chromium/manifest.json $DES

cd $DES
commit_num=$(git rev-list HEAD --count)

if [[ $# -eq 0 ]]; then
echo "*** FastForward.Chromium: Creating dev package... (Tip: Use nover to create a no-version package)"
bash ../../scripts/version.sh manifest.json 0
zip -qr ../$(basename $DIST)/FastForward_chromium_$(git shortlog | grep -E '^[ ]+\w+' | wc -l)_dev.zip .
zip -qr ../$(basename $DIST)/FastForward_chromium_${commit_num}_dev.zip .

elif [ "$1" == "nover" ] ; then
echo "*** FastForward.Chromium: Creating non-versioned package... "
rm injection_script.js
rm rules.json
bash ../../scripts/version.sh manifest.json nover
zip -qr ../$(basename $DIST)/FastForward_chromium_0.$(git shortlog | grep -E '^[ ]+\w+' | wc -l).zip .
zip -qr ../$(basename $DIST)/FastForward_chromium_0.${commit_num}.zip .

elif [ "$1" == "ver" ]; then
echo "*** FastForward.Chromium: Creating versioned package... "
Expand Down
5 changes: 3 additions & 2 deletions scripts/firefox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ bash ./scripts/copy_common.sh $DES
cp platform_spec/firefox/manifest.json $DES

cd $DES
commit_num=$(git rev-list HEAD --count)

if [[ $# -eq 0 ]]; then
echo "*** FastForward.firefox: Creating dev package... (Tip: Use nover to create a no-version package)"
bash ../../scripts/version.sh manifest.json 0
zip -qr ../$(basename $DIST)/FastForward_firefox_$(git shortlog | grep -E '^[ ]+\w+' | wc -l)_dev.xpi .
zip -qr ../$(basename $DIST)/FastForward_firefox_${commit_num}_dev.xpi .

elif [ "$1" == "nover" ] ; then
echo "*** FastForward.firefox: Creating non-versioned package... "
rm injection_script.js
rm rules.json
bash ../../scripts/version.sh manifest.json nover
zip -qr ../$(basename $DIST)/FastForward_firefox_0.$(git shortlog | grep -E '^[ ]+\w+' | wc -l).xpi .
zip -qr ../$(basename $DIST)/FastForward_firefox_0.$commit_num.xpi .

elif [ "$1" == "ver" ]; then
echo "*** FastForward.firefox: Creating versioned package... "
Expand Down
5 changes: 3 additions & 2 deletions scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
set -e

manifest_loc=$1
commit_num=$(git rev-list HEAD --count)


if [[ $# -lt 2 ]]; then #Creates a normal versioned json using only version.txt
Expand All @@ -15,13 +16,13 @@ if [[ $# -lt 2 ]]; then #Creates a normal versioned json using only version.txt

elif [ "$2" = "nover" ]; then #Creates a non-versioned json using only number of commits

version="0.$(git shortlog | grep -E '^[ ]+\w+' | wc -l)"
version="0.$commit_num"
sed -i '/"version":/c\ "version": "'$version'",' $1
echo vesrioned $(basename $1) to $version

else #Creates a json using the number of commits and appends the second argument to it

version="0.$(git shortlog | grep -E '^[ ]+\w+' | wc -l).$2"
version="0.$commit_num.$2"
sed -i '/"version":/c\ "version": "'$version'",' $1
echo vesrioned $(basename $1) to $version
fi
Expand Down

0 comments on commit e9655d3

Please sign in to comment.