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

61 lines
1.8 KiB
YAML

name: "deb-delivery"
description: "Deliver DEB packages"
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: Remove previously delivered DEBs
if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
run: rm -f ./*.deb
shell: bash
- name: Use cache DEB files
if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ./*.deb
key: ${{ inputs.cache_key }}
fail-on-cache-miss: true
- if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0
env:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}
- name: Publish DEBs to artifactory
if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
run: |
FILES="*.deb"
if [[ "${{ inputs.distrib }}" == "jammy" ]]; then
REPO_PREFIX="ubuntu"
else
REPO_PREFIX="apt"
fi
for FILE in $FILES; do
echo "[DEBUG] - File: $FILE"
ARCH=$(echo $FILE | cut -d '_' -f3 | cut -d '.' -f1)
jf rt upload "$FILE" "${REPO_PREFIX}-plugins-${{ inputs.stability }}/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
done
shell: bash