Clean up build release script

parent a6307afa
#!/bin/bash #!/bin/bash
set -o xtrace set -o xtrace
[ -z "${REMOTE_URL}" ] && REMOTE_URL=https://github.com/earlephilhower/arduino-pico/releases/download
if [ ! -z "${manualversion}" ]; then if [ ! -z "${manualversion}" ]; then
# manual-made release based on $manualversion # manual-made release based on $manualversion
ver=${manualversion} ver=${manualversion}
plain_ver=${ver} plain_ver=${ver}
visiblever=${ver} visible_ver=${ver}
[ -z "${REMOTE_URL}" ] && REMOTE_URL=https://github.com/earlephilhower/arduino-pico/releases/download
else else
...@@ -23,8 +24,8 @@ else ...@@ -23,8 +24,8 @@ else
if [ "$ver" == "null" ]; then if [ "$ver" == "null" ]; then
ver=$(git describe --tag) ver=$(git describe --tag)
fi fi
visiblever=$ver visible_ver=$ver
plainver=$ver plain_ver=$ver
# Match 0.0.* as special-case early-access builds # Match 0.0.* as special-case early-access builds
if [ "${ver%.*}" = 0.0 ]; then if [ "${ver%.*}" = 0.0 ]; then
...@@ -36,8 +37,8 @@ fi ...@@ -36,8 +37,8 @@ fi
set -e set -e
package_name=rp2040-$visiblever package_name=rp2040-$visible_ver
echo "Version: $visiblever ($ver)" echo "Version: $visible_ver ($ver)"
echo "Package name: $package_name" echo "Package name: $package_name"
# Set REMOTE_URL environment variable to the address where the package will be # Set REMOTE_URL environment variable to the address where the package will be
...@@ -50,18 +51,17 @@ echo "Remote: $REMOTE_URL" ...@@ -50,18 +51,17 @@ echo "Remote: $REMOTE_URL"
if [ -z "$PKG_URL" ]; then if [ -z "$PKG_URL" ]; then
if [ -z "$PKG_URL_PREFIX" ]; then if [ -z "$PKG_URL_PREFIX" ]; then
PKG_URL_PREFIX="$REMOTE_URL/$visiblever" PKG_URL_PREFIX="$REMOTE_URL/$visible_ver"
fi fi
PKG_URL="$PKG_URL_PREFIX/$package_name.zip" PKG_URL="$PKG_URL_PREFIX/$package_name.zip"
fi fi
echo "Package: $PKG_URL" echo "Package: $PKG_URL"
echo "Docs: $DOC_URL"
pushd .. pushd ..
# Create directory for the package # Create directory for the package
outdir=package/versions/$visiblever/$package_name outdir=package/versions/$visible_ver/$package_name
srcdir=$PWD srcdir=$PWD
rm -rf package/versions/$visiblever rm -rf package/versions/$visible_ver
mkdir -p $outdir mkdir -p $outdir
# Some files should be excluded from the package # Some files should be excluded from the package
...@@ -77,7 +77,7 @@ EOF ...@@ -77,7 +77,7 @@ EOF
git ls-files --other --directory >> exclude.txt git ls-files --other --directory >> exclude.txt
# Now copy files to $outdir # Now copy files to $outdir
rsync -a -L -K --exclude-from 'exclude.txt' $srcdir/ $outdir/ rsync -a -L -K --exclude-from 'exclude.txt' $srcdir/ $outdir/
mv $outdir/ArduinoCore-API/api $outdir/cores/rp2040/api #mv $outdir/ArduinoCore-API/api $outdir/cores/rp2040/api
rm -rf $outdir/ArduinoCore-API rm -rf $outdir/ArduinoCore-API
rm exclude.txt rm exclude.txt
...@@ -108,10 +108,10 @@ echo \#define ARDUINO_RP2040_GIT_DESC `git describe --tags 2>/dev/null` >>$outdi ...@@ -108,10 +108,10 @@ echo \#define ARDUINO_RP2040_GIT_DESC `git describe --tags 2>/dev/null` >>$outdi
echo \#define ARDUINO_RP2040_RELEASE_$ver_define >>$outdir/cores/rp2040/core_version.h echo \#define ARDUINO_RP2040_RELEASE_$ver_define >>$outdir/cores/rp2040/core_version.h
echo \#define ARDUINO_RP2040_RELEASE \"$ver_define\" >>$outdir/cores/rp2040/core_version.h echo \#define ARDUINO_RP2040_RELEASE \"$ver_define\" >>$outdir/cores/rp2040/core_version.h
$SED -i 's/"version": .*/"version": "'$visiblever'"/' $outdir/package.json $SED -i 's/"version": .*/"version": "'$visible_ver'"/' $outdir/package.json
# Zip the package # Zip the package
pushd package/versions/$visiblever pushd package/versions/$visible_ver
echo "Making $package_name.zip" echo "Making $package_name.zip"
zip -qr $package_name.zip $package_name zip -qr $package_name.zip $package_name
rm -rf $package_name rm -rf $package_name
...@@ -124,7 +124,7 @@ echo SHA-256: $sha ...@@ -124,7 +124,7 @@ echo SHA-256: $sha
echo "Making package_rp2040_index.json" echo "Making package_rp2040_index.json"
jq_arg=".packages[0].platforms[0].version = \"$visiblever\" | \ jq_arg=".packages[0].platforms[0].version = \"$visible_ver\" | \
.packages[0].platforms[0].url = \"$PKG_URL\" |\ .packages[0].platforms[0].url = \"$PKG_URL\" |\
.packages[0].platforms[0].archiveFileName = \"$package_name.zip\"" .packages[0].platforms[0].archiveFileName = \"$package_name.zip\""
...@@ -134,10 +134,6 @@ if [ -z "$is_nightly" ]; then ...@@ -134,10 +134,6 @@ if [ -z "$is_nightly" ]; then
.packages[0].platforms[0].checksum = \"SHA-256:$sha\"" .packages[0].platforms[0].checksum = \"SHA-256:$sha\""
fi fi
if [ ! -z "$DOC_URL" ]; then
jq_arg="$jq_arg |\
.packages[0].platforms[0].help.online = \"$DOC_URL\""
fi
cat $srcdir/package/package_pico_index.template.json | \ cat $srcdir/package/package_pico_index.template.json | \
jq "$jq_arg" > package_rp2040_index.json jq "$jq_arg" > package_rp2040_index.json
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment