mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-03 23:59:38 +00:00
146 lines
5.0 KiB
YAML
146 lines
5.0 KiB
YAML
# Build Linux packages from the pre-built xrpld and validator-keys artifacts:
|
|
#
|
|
# - one job per config that carries a "package" map in linux.json
|
|
# - that map names the container image and the format it builds there
|
|
# - every job ends with the image's publish_pkg.py, uploading what it built
|
|
# with 'publish: true' and doing a --dry-run otherwise
|
|
#
|
|
# Only linux/amd64 is supported; the runner is hardcoded in the job below.
|
|
name: Package
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
publish:
|
|
description: "Whether to publish the packages after building them."
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
nexus_url:
|
|
description: "The base URL of the Nexus instance hosting the deb and rpm repositories."
|
|
required: false
|
|
type: string
|
|
default: https://packages.xrplf.org
|
|
|
|
secrets:
|
|
remote_username:
|
|
description: "The username of a Nexus account with write access to the repositories."
|
|
required: false
|
|
remote_password:
|
|
description: "The password or token for that Nexus account."
|
|
required: false
|
|
signing_key:
|
|
description: "Armoured PGP private key used to sign the RPMs. Required when publishing."
|
|
required: false
|
|
|
|
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Generate packaging matrix
|
|
id: generate
|
|
working-directory: .github/scripts/strategy-matrix
|
|
run: ./generate.py --packaging >>"${GITHUB_OUTPUT}"
|
|
|
|
package:
|
|
needs: [generate-matrix]
|
|
if: ${{ github.event.repository.visibility == 'public' || startsWith(github.ref, 'refs/tags/') }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
|
name: "${{ matrix.xrpld_artifact_name }}"
|
|
permissions:
|
|
contents: read
|
|
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
|
|
container: ${{ matrix.image }}
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Prepare runner
|
|
uses: XRPLF/actions/prepare-runner@7bf7ceca5932114abdd0d43493c3c30c5a654e13
|
|
with:
|
|
enable_ccache: false
|
|
|
|
- name: Download pre-built xrpld binary
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: ${{ matrix.xrpld_artifact_name }}
|
|
path: ${{ env.BUILD_DIR }}
|
|
|
|
- name: Download pre-built validator-keys binary
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: ${{ matrix.validator_keys_artifact_name }}
|
|
path: ${{ env.BUILD_DIR }}
|
|
|
|
- name: Make binaries executable
|
|
run: chmod +x "${BUILD_DIR}/xrpld" "${BUILD_DIR}/validator-keys"
|
|
|
|
- name: Determine release info
|
|
id: release_info
|
|
uses: ./.github/actions/release-info
|
|
|
|
- name: Build package
|
|
env:
|
|
PACKAGE_TYPE: ${{ matrix.package_type }}
|
|
PKG_RELEASE: ${{ steps.release_info.outputs.pkg_release }}
|
|
CHANNEL: ${{ steps.release_info.outputs.channel }}
|
|
run: |
|
|
./package/build_pkg.py \
|
|
--package-type "${PACKAGE_TYPE}" \
|
|
--build-dir "${BUILD_DIR}" \
|
|
--pkg-release "${PKG_RELEASE}" \
|
|
--channel "${CHANNEL}"
|
|
|
|
# Before the upload, so the artifact and the published package are the
|
|
# same bytes. DEBs are not signed, so the key is never set on that job.
|
|
- name: Sign RPM
|
|
if: ${{ inputs.publish && matrix.package_type == 'rpm' }}
|
|
env:
|
|
PKG_SIGNING_KEY: ${{ secrets.signing_key }}
|
|
run: ./package/sign_rpm.py --package-dir "${BUILD_DIR}"
|
|
|
|
- name: Upload package artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: ${{ matrix.xrpld_artifact_name }}-pkg
|
|
path: |
|
|
${{ env.BUILD_DIR }}/debbuild/*.deb
|
|
${{ env.BUILD_DIR }}/debbuild/*.ddeb
|
|
${{ env.BUILD_DIR }}/rpmbuild/RPMS/**/*.rpm
|
|
if-no-files-found: error
|
|
|
|
- name: Publish package
|
|
env:
|
|
CHANNEL: ${{ steps.release_info.outputs.channel }}
|
|
DRY_RUN_OPTION: ${{ !inputs.publish && '--dry-run' || '' }}
|
|
NEXUS_URL: ${{ inputs.nexus_url }}
|
|
NEXUS_USERNAME: ${{ inputs.publish && secrets.remote_username || '' }}
|
|
NEXUS_PASSWORD: ${{ inputs.publish && secrets.remote_password || '' }}
|
|
run: |
|
|
publish_pkg.py \
|
|
--channel "${CHANNEL}" \
|
|
--package-dir "${BUILD_DIR}" \
|
|
--nexus-url "${NEXUS_URL}" \
|
|
${DRY_RUN_OPTION}
|