general cleanup, merge of package&package-nfpm
This commit is contained in:
parent
12ee977b95
commit
8451fdce12
|
@ -10,6 +10,9 @@ inputs:
|
|||
distrib:
|
||||
description: The package distrib
|
||||
required: true
|
||||
version:
|
||||
description: The package version ([major_version].[minor_version])
|
||||
required: false
|
||||
major_version:
|
||||
description: The major version
|
||||
required: false
|
||||
|
@ -62,8 +65,15 @@ runs:
|
|||
RPM_GPG_SIGNING_KEY_ID: ${{ inputs.rpm_gpg_signing_key_id }}
|
||||
RPM_GPG_SIGNING_PASSPHRASE: ${{ inputs.rpm_gpg_signing_passphrase }}
|
||||
run: |
|
||||
export MAJOR_VERSION="${{ inputs.major_version }}"
|
||||
if [ -z ${{ inputs.version }} ]; then
|
||||
export VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}"
|
||||
export MAJOR_VERSION="${{ inputs.major_version }}"
|
||||
export MINOR_VERSION="${{ inputs.minor_version }}"
|
||||
elif [ -z ${{ inputs.major_version }} ];
|
||||
export VERSION="${{ inputs.version }}"
|
||||
export MAJOR_VERSION=$( echo $MAJOR_VERSION | cut -d "-" -f1 )
|
||||
export MINOR_VERSION=$( echo $MAJOR_VERSION | cut -d "-" -f2 )
|
||||
fi
|
||||
export RELEASE="${{ inputs.release }}"
|
||||
export ARCH="${{ inputs.arch }}"
|
||||
|
||||
|
@ -82,9 +92,9 @@ runs:
|
|||
export APACHE_GROUP="www-data"
|
||||
fi
|
||||
|
||||
if [[ "$MAJOR_VERSION" != "" ]]; then
|
||||
MAJOR_LEFT=$( echo $MAJOR_VERSION | cut -d "." -f1 )
|
||||
MAJOR_RIGHT=$( echo $MAJOR_VERSION | cut -d "-" -f1 | cut -d "." -f2 )
|
||||
BUMP_MAJOR_RIGHT=$(( MAJOR_RIGHT_PART + 1 ))
|
||||
if [ "$MAJOR_RIGHT" = "04" ]; then
|
||||
BUMP_MAJOR_LEFT="$MAJOR_LEFT"
|
||||
BUMP_MAJOR_RIGHT="10"
|
||||
|
@ -92,8 +102,9 @@ runs:
|
|||
BUMP_MAJOR_LEFT=$(( $MAJOR_LEFT + 1 ))
|
||||
BUMP_MAJOR_RIGHT="04"
|
||||
fi
|
||||
|
||||
export NEXT_MAJOR_VERSION="$BUMP_MAJOR_LEFT.$BUMP_MAJOR_RIGHT"
|
||||
fi
|
||||
|
||||
|
||||
export RPM_SIGNING_KEY_FILE="$(pwd)/key.gpg"
|
||||
export RPM_SIGNING_KEY_ID="$RPM_GPG_SIGNING_KEY_ID"
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
name: package
|
||||
description: Package module using nfpm
|
||||
inputs:
|
||||
nfpm_file_pattern:
|
||||
description: The pattern of the nfpm configuration file(s)
|
||||
required: true
|
||||
package_extension:
|
||||
description: The package extension (deb or rpm)
|
||||
required: true
|
||||
distrib:
|
||||
description: The package distrib
|
||||
required: true
|
||||
version:
|
||||
description: The package version
|
||||
required: false
|
||||
release:
|
||||
description: The package release number
|
||||
required: false
|
||||
commit_hash:
|
||||
description: The commit hash
|
||||
required: true
|
||||
cache_key:
|
||||
description: The package files cache key
|
||||
required: true
|
||||
rpm_gpg_key:
|
||||
description: The rpm gpg key
|
||||
required: true
|
||||
rpm_gpg_signing_key_id:
|
||||
description: The rpm gpg signing key identifier
|
||||
required: true
|
||||
rpm_gpg_signing_passphrase:
|
||||
description: The rpm gpg signing passphrase
|
||||
required: true
|
||||
stability:
|
||||
description: "The package stability (stable, testing, unstable, canary)"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Import gpg key
|
||||
env:
|
||||
RPM_GPG_SIGNING_KEY: ${{ inputs.rpm_gpg_key }}
|
||||
run: echo -n "$RPM_GPG_SIGNING_KEY" > key.gpg
|
||||
shell: bash
|
||||
|
||||
- name: Build ${{ inputs.package_extension }} files
|
||||
env:
|
||||
RPM_GPG_SIGNING_KEY_ID: ${{ inputs.rpm_gpg_signing_key_id }}
|
||||
RPM_GPG_SIGNING_PASSPHRASE: ${{ inputs.rpm_gpg_signing_passphrase }}
|
||||
run: |
|
||||
export VERSION="${{ inputs.version }}"
|
||||
export RELEASE="${{ inputs.release }}"
|
||||
|
||||
if [ "${{ inputs.package_extension }}" = "rpm" ]; then
|
||||
export DIST=".${{ inputs.distrib }}"
|
||||
else
|
||||
if [ "${{ inputs.stability }}" = "unstable" ] || [ "${{ inputs.stability }}" = "canary" ]; then
|
||||
export RELEASE="$RELEASE-${{ inputs.distrib }}"
|
||||
elif [ "${{ inputs.stability }}" = "testing" ]; then
|
||||
export RELEASE="${{ inputs.distrib }}"
|
||||
fi
|
||||
export DIST=""
|
||||
fi
|
||||
|
||||
export RPM_SIGNING_KEY_FILE="$(pwd)/key.gpg"
|
||||
export RPM_SIGNING_KEY_ID="$RPM_GPG_SIGNING_KEY_ID"
|
||||
export NFPM_RPM_PASSPHRASE="$RPM_GPG_SIGNING_PASSPHRASE"
|
||||
|
||||
for FILE in ${{ inputs.nfpm_file_pattern }}; do
|
||||
DIRNAME=$(dirname $FILE)
|
||||
BASENAME=$(basename $FILE)
|
||||
cd $DIRNAME
|
||||
sed -i "s/@COMMIT_HASH@/${{ inputs.commit_hash }}/g" $BASENAME
|
||||
nfpm package --config $BASENAME --packager ${{ inputs.package_extension }}
|
||||
cd -
|
||||
mv $DIRNAME/*.${{ inputs.package_extension }} ./
|
||||
done
|
||||
shell: bash
|
||||
|
||||
- name: Upload package artifacts
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
with:
|
||||
name: packages-${{ inputs.distrib }}
|
||||
path: ./*.${{ inputs.package_extension }}
|
||||
retention-days: 1
|
||||
|
||||
- name: Cache packages
|
||||
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
with:
|
||||
path: ./*.${{ inputs.package_extension }}
|
||||
key: ${{ inputs.cache_key }}
|
|
@ -57,7 +57,7 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "connectors/vmware/packaging/centreon-plugin-virtualization-vmware-daemon.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
|
|
@ -97,7 +97,7 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "nrpe/packaging/*.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
|
|
@ -85,7 +85,7 @@ jobs:
|
|||
fail-on-cache-miss: true
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "selinux/packaging/centreon-plugins-selinux.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
|
|
@ -217,7 +217,7 @@ jobs:
|
|||
done
|
||||
shell: bash
|
||||
|
||||
- uses: ./.github/actions/package
|
||||
- uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: ".github/packaging/*.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
|
Loading…
Reference in New Issue