-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
8c7bf56
commit 3158434
Showing
1 changed file
with
46 additions
and
0 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,46 @@ | ||
#!/bin/sh | ||
|
||
# inspired by https://github.com/Bouni/kicad-jlcpcb-tools/blob/main/PCM/create_pcm_archive.sh | ||
|
||
VERSION=$1 | ||
|
||
echo "Clean up old files" | ||
rm -f PCM/*.zip | ||
rm -rf PCM/archive | ||
|
||
|
||
echo "Create folder structure for ZIP" | ||
mkdir -p PCM/archive/plugins | ||
mkdir -p PCM/archive/resources | ||
|
||
echo "Copy files to destination" | ||
cp VERSION PCM/archive/plugins | ||
cp *.py PCM/archive/plugins | ||
cp *.png PCM/archive/plugins | ||
cp config.json PCM/archive/plugins | ||
cp PCM/icon.png PCM/archive/resources | ||
cp PCM/metadata.template.json PCM/archive/metadata.json | ||
|
||
echo "Write version info to file" | ||
echo $VERSION > PCM/archive/plugins/VERSION | ||
|
||
echo "Modify archive metadata.json" | ||
sed -i "s/VERSION_HERE/$VERSION/g" PCM/archive/metadata.json | ||
sed -i "s/\"kicad_version\": \"6.0\",/\"kicad_version\": \"6.0\"/g" PCM/archive/metadata.json | ||
sed -i "/SHA256_HERE/d" PCM/archive/metadata.json | ||
sed -i "/DOWNLOAD_SIZE_HERE/d" PCM/archive/metadata.json | ||
sed -i "/DOWNLOAD_URL_HERE/d" PCM/archive/metadata.json | ||
sed -i "/INSTALL_SIZE_HERE/d" PCM/archive/metadata.json | ||
|
||
echo "Zip PCM archive" | ||
cd PCM/archive | ||
zip -r ../KiCAD-PCM-$VERSION.zip . | ||
cd ../.. | ||
|
||
echo "Gather data for repo rebuild" | ||
echo VERSION=$VERSION >> $GITHUB_ENV | ||
echo DOWNLOAD_SHA256=$(shasum --algorithm 256 PCM/KiCAD-PCM-$VERSION.zip | xargs | cut -d' ' -f1) >> $GITHUB_ENV | ||
echo DOWNLOAD_SIZE=$(ls -l PCM/KiCAD-PCM-$VERSION.zip | xargs | cut -d' ' -f5) >> $GITHUB_ENV | ||
echo DOWNLOAD_URL="https:\/\/github.com\/SYSUeric66\/kicad-amf-plugin\/releases\/download\/$VERSION\/KiCAD-PCM-$VERSION.zip" >> $GITHUB_ENV | ||
echo INSTALL_SIZE=$(unzip -l PCM/KiCAD-PCM-$VERSION.zip | tail -1 | xargs | cut -d' ' -f1) >> $GITHUB_ENV | ||
|