Skip to content

Create RPM packages

Create RPM packages #8

name: Create RPM packages
on: [workflow_dispatch,workflow_call]
permissions: write-all
jobs:
create-release:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Create rpm packages
run: |
sudo apt install -y createrepo-c rpm
REPO_DIR=$PWD
TAG=$(git ls-remote --tags https://github.com/ton-blockchain/ton/ | tail -1 | sed -n -e 's/^.*tags\///p')
TAG=$(echo $TAG | sed s'/-/./')
echo "latest TAG = $TAG"
mkdir ../work; cd ../work
curl -Ls https://github.com/ton-blockchain/ton/releases/latest/download/ton-linux-arm64.zip -o ton-linux-arm64.zip
curl -Ls https://github.com/ton-blockchain/ton/releases/latest/download/ton-linux-x86_64.zip -o ton-linux-x86_64.zip
unzip -qq ton-linux-arm64.zip -d ton-linux-arm64
unzip -qq ton-linux-x86_64.zip -d ton-linux-x86_64
mkdir -p ton-linux-rpm-aarch64/{bin,lib/fift,share/ton}
cp -r ton-linux-arm64/smartcont ton-linux-rpm-aarch64/share/ton/
cp ton-linux-arm64/lib/* ton-linux-rpm-aarch64/lib/fift/
rm -rf ton-linux-arm64/{lib,smartcont}
rm -f ton-linux-arm64/{create-hardfork,rldp-http-proxy}
mv ton-linux-arm64/libtonlibjson.so* ton-linux-rpm-aarch64/lib/
[ -e ton-linux-arm64/libemulator.so ] && mv ton-linux-arm64/libemulator.so ton-linux-rpm-aarch64/lib/
cp ton-linux-arm64/* ton-linux-rpm-aarch64/bin/
chmod -R 555 ton-linux-rpm-aarch64/{bin,lib,share}/*
mkdir -p ton-linux-rpm-x86_64/{bin,lib/fift,share/ton}
cp -r ton-linux-x86_64/smartcont ton-linux-rpm-x86_64/share/ton/
cp ton-linux-x86_64/lib/* ton-linux-rpm-x86_64/lib/fift/
rm -rf ton-linux-x86_64/{lib,smartcont}
rm -f ton-linux-x86_64//{create-hardfork,rldp-http-proxy}
mv ton-linux-x86_64/libtonlibjson.so* ton-linux-rpm-x86_64/lib/
[ -e ton-linux-x86_64/libemulator.so ] && mv ton-linux-x86_64/libemulator.so ton-linux-rpm-x86_64/lib/
cp ton-linux-x86_64/* ton-linux-rpm-x86_64/bin/
chmod -R 555 ton-linux-rpm-x86_64/{bin,lib,share}/*
mkdir ton-linux-x86_64-tmp
cp -R ton-linux-rpm-x86_64/* ton-linux-x86_64-tmp
tar -czvf ton-linux-x86-64.tar.gz -C ton-linux-x86_64-tmp .
tar -tvf ton-linux-x86-64.tar.gz
mkdir packages-out
# rpm
chmod +x $REPO_DIR/packages/rpm.sh
$REPO_DIR/packages/rpm.sh packages-out $REPO_DIR/packages/rpm/SPECS/ton.spec $PWD/ton-linux-rpm-x86_64 x86_64 ${TAG:1}
$REPO_DIR/packages/rpm.sh packages-out $REPO_DIR/packages/rpm/SPECS/ton.spec $PWD/ton-linux-rpm-aarch64 aarch64 ${TAG:1}
cd packages-out/rpm-install
createrepo_c .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## RPM release
# We can't rely on GH Releases for RPM because RPM repo must have a repodata/ directory and Releases don't support directories
- name: Push latest artifacts to current rpm-repo
run: |
TAG=$(git ls-remote --tags https://github.com/ton-blockchain/ton/ | tail -1 | sed -n -e 's/^.*tags\///p')
echo "latest TAG $TAG"
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git config http.postBuffer 924288000
git config http.lowSpeedTime 600
git reset --hard origin/main
rm -rf rpm
cp -r ../work/packages-out/rpm-install rpm
# one-by-one, since there is a gh limit of 100 MB upload
git add rpm/x86_64/
git commit -m "add x86_64 rpm $TAG" || true
git push
git add rpm/aarch64/
git commit -m "add aarch64 rpm $TAG" || true
git push
git add rpm/repodata/
git commit -m "create release repodata $TAG" || true
git push
gh release create --notes "" $TAG ../work/ton-linux-x86-64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}