-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathaction.yml
More file actions
76 lines (64 loc) · 2.02 KB
/
Copy pathaction.yml
File metadata and controls
76 lines (64 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: "rpm-delivery"
description: "Deliver rpm 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: "Artifactory token"
required: true
runs:
using: "composite"
steps:
- name: Use cache RPM files
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ./*.rpm
key: ${{ inputs.cache_key }}
fail-on-cache-miss: true
- uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1
env:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}
- name: Publish RPMs
env:
MODULE_NAME: ${{ inputs.module_name }}
DISTRIB: ${{ inputs.distrib }}
STABILITY: ${{ inputs.stability }}
run: |
FILES="*.rpm"
echo "[DEBUG] - Distrib: $DISTRIB"
if [ -z "$MODULE_NAME" ]; then
echo "module name is required"
exit 1
fi
if [ -z "$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"
mv "$FILE" "$ARCH"
done
for ARCH in "noarch" "x86_64"; do
if [ "$(ls -A $ARCH)" ]; then
if [ "$STABILITY" == "stable" ]; then
jf rt upload "${ARCH}/*.rpm" "rpm-plugins/${DISTRIB}/${STABILITY}/${ARCH}/RPMS/${MODULE_NAME}/" --flat
else
jf rt upload "${ARCH}/*.rpm" "rpm-plugins/${DISTRIB}/${STABILITY}/${ARCH}/${MODULE_NAME}/" --flat
fi
fi
done
shell: bash