centreon-plugins/.github/actions/rpm-delivery/action.yml

72 lines
1.8 KiB
YAML

name: "rpm-delivery"
description: "rpm delivery"
inputs:
module_name:
description: "The package module name"
required: true
distrib:
description: "The distribution used for packaging"
required: true
cache_key:
description: "The cached package key"
required: true
stability:
description: "The package stability (stable, testing, unstable)"
required: true
artifactory_token:
description: "token for artifactory"
required: true
runs:
using: "composite"
steps:
- name: Use cache RPM files
uses: actions/cache@v3
with:
path: ./*.rpm
key: ${{ inputs.cache_key }}
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}
- name: Publish RPMs to plugins repository
run: |
FILES="*.rpm"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
if [ -z "${{ inputs.module_name }}" ]; then
echo "module name is required"
exit 1
fi
if [ -z "${{ inputs.distrib }}" ]; then
echo "distrib is required"
exit 1
fi
mkdir noarch x86_64
for FILE in $FILES; do
echo "[DEBUG] - File: $FILE"
ARCH=$(echo $FILE | grep -oP '(x86_64|noarch)')
echo "[DEBUG] - Arch: $ARCH"
cp "$FILE" "$ARCH"
done
for ARCH in "noarch" "x86_64"; do
if [ "$(ls -A $ARCH)" ]; then
if [ "${{ inputs.stability }}" == "stable" ]; then
jf rt upload "$ARCH/*.rpm" "rpm-plugins/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/" --flat
else
jf rt upload "$ARCH/*.rpm" "rpm-plugins/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/${{ inputs.module_name }}/" --flat
fi
fi
done
shell: bash