gupax/utils/prepare.sh
hinto-janaiyo 9d66a20360
status: enable p2pool/xmrig "Image" stats
These couldn't be fit in before since there wasn't enough space.
They still can't all fit in, but the most important ones can be
after adjusting the font sizes and height spacing.
2022-12-23 14:06:25 -05:00

48 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# prepare new [gupax] version in:
# 1. README.md
# 2. CHANGELOG.md
# 3. Cargo.toml
# $1 = new_version
set -ex
sudo -v
[[ $1 = v* ]]
[[ $PWD = */gupax ]]
# get old GUPAX_VER
OLD_VER="v$(grep -m1 "version" Cargo.toml | grep -o "[0-9].[0-9].[0-9]")"
OLD_VER_NUM="$(grep -m1 "version" Cargo.toml | grep -o "[0-9].[0-9].[0-9]")"
# get p2pool/xmrig version
P2POOL_VERSION="$(grep "P2POOL_VERSION" src/constants.rs | grep -o "\"v[0-9].*\"")"
XMRIG_VERSION="$(grep "XMRIG_VERSION" src/constants.rs | grep -o "\"v[0-9].*\"")"
# sed change
sed -i "s/$OLD_VER/$1/g" README.md
sed -i 's/^version = "$OLD_VER_NUM"/$1/' Cargo.toml
# changelog
cat << EOM > CHANGELOG.md.new
# $1
## Updates
*
## Fixes
*
## Bundled Versions
* [\`P2Pool ${P2POOL_VERSION//\"/}\`](https://github.com/SChernykh/p2pool/releases/tag/${P2POOL_VERSION//\"/})
* [\`XMRig ${XMRIG_VERSION//\"/}\`](https://github.com/xmrig/xmrig/releases/tag/${XMRIG_VERSION//\"/})
---
EOM
cat CHANGELOG.md >> CHANGELOG.md.new
mv -f CHANGELOG.md.new CHANGELOG.md
# commit
git add CHANGELOG.md README.md
git commit -m "prepare $1"