mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 09:46:53 +00:00
Co-authored-by: semgrep-companion-app[bot] <218312740+semgrep-companion-app[bot]@users.noreply.github.com>
123 lines
4.0 KiB
YAML
123 lines
4.0 KiB
YAML
# Build Linux packages (DEB and RPM) from pre-built binary artifacts.
|
|
# Discovers which configurations to package from linux.json (configs in
|
|
# "package_configs") and fans out one job per distro. Only linux/amd64 is
|
|
# supported; the runner is hardcoded in the job below.
|
|
name: Package
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
pkg_release:
|
|
description: "Package release number. Increment when repackaging the same executable."
|
|
required: false
|
|
type: string
|
|
default: "1"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
env:
|
|
BUILD_DIR: build
|
|
|
|
jobs:
|
|
generate-matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.generate.outputs.matrix }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Generate packaging matrix
|
|
id: generate
|
|
working-directory: .github/scripts/strategy-matrix
|
|
run: ./generate.py --packaging >>"${GITHUB_OUTPUT}"
|
|
|
|
generate-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
sparse-checkout: |
|
|
.github/actions/generate-version
|
|
src/libxrpl/protocol/BuildInfo.cpp
|
|
- name: Generate version
|
|
id: version
|
|
uses: ./.github/actions/generate-version
|
|
|
|
package:
|
|
needs: [generate-matrix, generate-version]
|
|
if: ${{ github.event.repository.visibility == 'public' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
|
name: "${{ matrix.artifact_name }}"
|
|
permissions:
|
|
contents: read
|
|
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
|
|
container: ${{ matrix.image }}
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
# Packaging runs in a vanilla distro image, so the tooling has to come
|
|
# from the distro's archive: debhelper for deb, rpm-build (and the
|
|
# systemd / find-debuginfo macros it depends on) for rpm. Run this
|
|
# before actions/checkout so the latter can use git (real history) for
|
|
# build_pkg.sh's SOURCE_DATE_EPOCH; otherwise it falls back to a tarball
|
|
# download and the timestamp comes from wall-clock time.
|
|
- name: Install packaging tooling (deb)
|
|
if: ${{ matrix.distro == 'debian' }}
|
|
run: |
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
debhelper \
|
|
git
|
|
|
|
- name: Install packaging tooling (rpm)
|
|
if: ${{ matrix.distro == 'rhel' }}
|
|
run: |
|
|
dnf install -y --setopt=install_weak_deps=False \
|
|
git \
|
|
rpm-build \
|
|
redhat-rpm-config \
|
|
systemd-rpm-macros
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Download pre-built binary
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: ${{ env.BUILD_DIR }}
|
|
|
|
- name: Make binary executable
|
|
run: chmod +x "${BUILD_DIR}/xrpld"
|
|
|
|
- name: Build package
|
|
env:
|
|
PKG_VERSION: ${{ needs.generate-version.outputs.version }}
|
|
PKG_RELEASE: ${{ inputs.pkg_release }}
|
|
run: ./package/build_pkg.sh
|
|
|
|
- name: Upload package artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: ${{ matrix.artifact_name }}-pkg-${{ needs.generate-version.outputs.version }}
|
|
path: |
|
|
${{ env.BUILD_DIR }}/debbuild/*.deb
|
|
${{ env.BUILD_DIR }}/debbuild/*.ddeb
|
|
${{ env.BUILD_DIR }}/rpmbuild/RPMS/**/*.rpm
|
|
if-no-files-found: error
|