Make deb/rpm packages when creating release (#3796)

* Make deb/rpm packages when creating release

A step towards #3782

* fix arch for arm
This commit is contained in:
Jacek Sieka 2022-06-28 22:34:18 +02:00 committed by GitHub
parent 45ad4abe30
commit 0152f4ade5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 6 deletions

View File

@ -49,6 +49,20 @@ jobs:
DOCKER_BUILDKIT=1 docker build -f Dockerfile.amd64 -t statusim/nimbus-eth2:amd64-${TAG} -t statusim/nimbus-eth2:amd64-latest .
docker push statusim/nimbus-eth2:amd64-${TAG}
docker push statusim/nimbus-eth2:amd64-latest
- name: Setup ruby # Needed for fpm
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
- name: Create RPM/DEB
run: scripts/make_packages.sh -t dist/*.tar.gz --install-fpm
- name: Upload DEB
uses: actions/upload-artifact@v3
with:
name: Linux_amd64_packages
path: |
./dist/*.deb
./dist/*.rpm
retention-days: 2
build-arm64:
name: Linux ARM64 release asset
runs-on: ubuntu-latest
@ -100,6 +114,20 @@ jobs:
DOCKER_BUILDKIT=1 docker build -f Dockerfile.arm64 -t statusim/nimbus-eth2:arm64-${TAG} -t statusim/nimbus-eth2:arm64-latest .
docker push statusim/nimbus-eth2:arm64-${TAG}
docker push statusim/nimbus-eth2:arm64-latest
- name: Setup ruby # Needed for fpm
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
- name: Create RPM/DEB
run: scripts/make_packages.sh -t dist/*.tar.gz --install-fpm
- name: Upload DEB
uses: actions/upload-artifact@v3
with:
name: Linux_arm64_packages
path: |
./dist/*.deb
./dist/*.rpm
retention-days: 2
build-arm:
name: Linux ARM release asset
runs-on: ubuntu-latest
@ -151,6 +179,20 @@ jobs:
DOCKER_BUILDKIT=1 docker build -f Dockerfile.arm -t statusim/nimbus-eth2:arm-${TAG} -t statusim/nimbus-eth2:arm-latest .
docker push statusim/nimbus-eth2:arm-${TAG}
docker push statusim/nimbus-eth2:arm-latest
- name: Setup ruby # Needed for fpm
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
- name: Create RPM/DEB
run: scripts/make_packages.sh -t dist/*.tar.gz --install-fpm
- name: Upload DEB
uses: actions/upload-artifact@v3
with:
name: Linux_arm_packages
path: |
./dist/*.deb
./dist/*.rpm
retention-days: 2
build-win64:
name: Windows AMD64 release asset
runs-on: ubuntu-latest
@ -280,8 +322,11 @@ jobs:
body_path: release_notes.md
files: |
Linux_amd64_archive/*
Linux_amd64_packages/*
Linux_arm64_archive/*
Linux_arm64_packages/*
Linux_arm_archive/*
Linux_arm_packages/*
Windows_amd64_archive/*
macOS_amd64_archive/*
macOS_arm64_archive/*
@ -292,10 +337,13 @@ jobs:
name: |
Linux_amd64_archive
Linux_amd64_checksum
Linux_amd64_packages
Linux_arm64_archive
Linux_arm64_checksum
Linux_arm64_packages
Linux_arm_archive
Linux_arm_checksum
Linux_arm_packages
Windows_amd64_archive
Windows_amd64_checksum
macOS_amd64_archive

View File

@ -27,7 +27,7 @@ if [ ${PIPESTATUS[0]} != 4 ]; then
fi
OPTS="ht:"
LONGOPTS="help,tarball:"
LONGOPTS="help,tarball:,install-fpm"
# default values
TARBALL=""
@ -39,6 +39,7 @@ Usage: $(basename "$0") --tarball dist/nimbus-eth2_Linux_amd64_1.5.4_382be3fd.ta
-h, --help this help message
-t, --tarball tarball produced by "make dist-..."
--install-fpm install the appropriate fpm version with "gem'
EOF
}
@ -60,6 +61,10 @@ while true; do
TARBALL="$2"
shift 2
;;
--install-fpm)
INSTALL_FPM="1"
shift 1
;;
--)
shift
break
@ -96,12 +101,21 @@ PKG_IMG_DIR="${SCRIPT_DIR}/package_image"
BINARIES="nimbus_beacon_node"
PKG_VERSION="$(echo "${TARBALL}" | sed 's/^.*_\([^_]\+\)_[^_]\+$/\1/')"
TARBALL_TOP_DIR="$(echo "${TARBALL}" | sed 's#^.*/\([^/]\+\)\.tar\.gz$#\1#')"
PKG_PATH_DEB="${SCRIPT_DIR}/../build/${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH_DEB}.deb"
PKG_PATH_RPM="${SCRIPT_DIR}/../build/${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH_RPM}.rpm"
PKG_PATH_DEB="${SCRIPT_DIR}/../dist/${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH_DEB}.deb"
PKG_PATH_RPM="${SCRIPT_DIR}/../dist/${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH_RPM}.rpm"
if ! command -v fpm &> /dev/null;then
printf "Please install FPM! \nhttps://fpm.readthedocs.io/en/latest/installation.html\n"
exit 1
FPM_VERSION=1.14.2
if [[ "$(fpm -v)" != "$FPM_VERSION" ]] ; then
if [[ "$INSTALL_FPM" == "1" ]] ; then
gem install fpm -v $FPM_VERSION
else
cat << EOF
Please install FPM $FPM_VERSION (https://fpm.readthedocs.io/en/latest/installation.html):
gem install fpm -v $FPM_VERSION
EOF
exit 1
fi
fi
BIN_DIR="${PKG_IMG_DIR}/usr/bin"
@ -119,6 +133,7 @@ fpm -s dir -t deb -n "${PKG_NAME}" \
-v "${PKG_VERSION}" \
-C "${PKG_IMG_DIR}" \
-p "${PKG_PATH_DEB}" \
-a "${PKG_ARCH_DEB}" \
--depends lsb-release \
--after-install "${PKG_IMG_DIR}/after_install" \
--before-remove "${PKG_IMG_DIR}/before_remove" \
@ -135,6 +150,7 @@ fpm -s dir -t rpm -n "${PKG_NAME}" \
-v "${PKG_VERSION}" \
-C "${PKG_IMG_DIR}" \
-p "${PKG_PATH_RPM}" \
-a "${PKG_ARCH_RPM}" \
--depends redhat-lsb-core \
--after-install "${PKG_IMG_DIR}/after_install" \
--before-remove "${PKG_IMG_DIR}/before_remove" \