Skip to content

Commit

Permalink
Add JSON minification step
Browse files Browse the repository at this point in the history
  • Loading branch information
NeRdTheNed committed May 19, 2023
1 parent edab300 commit e6fdf03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/draftrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
run: sudo apt-get install advancecomp
- name: Install strip-nondeterminism
run: sudo apt-get install strip-nondeterminism
- name: Install jq
run: sudo apt-get install jq
- name: Build with Gradle
env:
BUILD_RELEASE: ${{ github.event.release.prerelease == false }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: sudo apt-get install advancecomp
- name: Install strip-nondeterminism
run: sudo apt-get install strip-nondeterminism
- name: Install jq
run: sudo apt-get install jq
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
Expand Down
14 changes: 14 additions & 0 deletions removeDirectoryEntries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ for file in ./build/libs/*.jar
do
unzip "$file" -d ./build/libs/temp
rm "$file"
find ./build/libs/temp/ -iname '*.json' -type f -print0 | while IFS= read -r -d $'\0' jsonFile
do
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v gsed &> /dev/null
then
echo "Please install GNU sed as gsed"
else
jq -c . < "$jsonFile" | gsed -z '$ s/\n$//' > "$jsonFile-tempOut"
fi
else
jq -c . < "$jsonFile" | sed -z '$ s/\n$//' > "$jsonFile-tempOut"
fi
mv "$jsonFile-tempOut" "$jsonFile"
done
# TODO replace this with standard zip
advzip "$file" --shrink-store --pedantic -a ./build/libs/temp/**
rm -rf ./build/libs/temp/
Expand Down

0 comments on commit e6fdf03

Please sign in to comment.