Skip to content

Commit

Permalink
cleanup script for easier copy pasta
Browse files Browse the repository at this point in the history
  • Loading branch information
phyzical committed Oct 2, 2024
1 parent f2d0066 commit d379995
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
# TODO: lock down main pushes
jobs:
publish:
concurrency:
Expand Down
15 changes: 8 additions & 7 deletions pkg_build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash

plugin_name="docker.labelInjector"
CWD=$(pwd)
tmpdir="$CWD/tmp/tmp.$(($RANDOM * 19318203981230 + 40))"
version=$(date +"%Y.%m.%d")
filename="$CWD/archive/docker.labelInjector-$version.txz"
filename="$CWD/archive/$plugin_name-$version.txz"
rm "$filename"
dayversion=$(ls "$CWD"/archive/docker.labelInjector-"$version"*.txz 2>/dev/null | wc -l)
dayversion=$(ls "$CWD"/archive/$plugin_name-"$version"*.txz 2>/dev/null | wc -l)

if [ "$dayversion" -gt 0 ]; then
filename=$CWD/archive/docker.labelInjector-$version.$dayversion.txz
filename=$CWD/archive/$plugin_name-$version.$dayversion.txz
fi
mkdir -p "$tmpdir"

rsync -av --progress src/docker.labelInjector/ "$tmpdir" --exclude .git --exclude tmp --exclude .env --exclude archive
rsync -av --progress src/$plugin_name/ "$tmpdir" --exclude .git --exclude tmp --exclude .env --exclude archive

cd "$tmpdir" || exit

Expand All @@ -26,11 +27,11 @@ cd - || exit

rm -rf "$tmpdir"

sed -i '' 's/<!ENTITY version ".*">/<!ENTITY version "'"$version"'">/' docker.labelInjector.plg
sed -i '' 's/<!ENTITY version ".*">/<!ENTITY version "'"$version"'">/' $plugin_name.plg
md5hash=$(md5 -q "$filename")
sed -i '' 's/<!ENTITY md5 ".*">/<!ENTITY md5 "'"$md5hash"'">/' docker.labelInjector.plg
sed -i '' 's/<!ENTITY md5 ".*">/<!ENTITY md5 "'"$md5hash"'">/' $plugin_name.plg

echo "MD5: $(md5sum "$filename")"
echo "once pushed install via https://raw.githubusercontent.com/phyzical/docker.labelInjector/main/docker.labelInjector.plg"
echo "once pushed install via https://raw.githubusercontent.com/phyzical/$plugin_name/main/$plugin_name.plg"

$tar_command -tvf "$filename"

0 comments on commit d379995

Please sign in to comment.