-
Notifications
You must be signed in to change notification settings - Fork 283
197 lines (165 loc) · 6.54 KB
/
perl-json-path.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: perl-json-path
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- "dependencies/perl-json-path/**"
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- "dependencies/perl-json-path/**"
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
package:
needs: [get-environment]
if: ${{ needs.get-environment.outputs.stability != 'stable' }}
strategy:
fail-fast: false
matrix:
include:
- image: packaging-plugins-alma8
distrib: el8
package_extension: rpm
- image: packaging-plugins-alma9
distrib: el9
package_extension: rpm
- image: packaging-plugins-bullseye
distrib: bullseye
package_extension: deb
- image: packaging-plugins-bookworm
distrib: bookworm
package_extension: deb
- image: packaging-plugins-jammy
distrib: jammy
package_extension: deb
runs-on: ubuntu-22.04
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
name: package ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install locally JSON::Path
run: |
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
apt-get update
apt-get install -y cpanminus gcc
else
dnf install -y cpanminus gcc
fi
if [ "${{ matrix.distrib }}" = "el8" ]; then
cpanm -v -l /tmp JSON::[email protected]
else
cpanm -v -l /tmp JSON::[email protected]
fi
shell: bash
- name: Set package name and paths according to distrib
run: |
VERSION="1.0.4"
PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g")
echo "Perl version is $PERL_VERSION"
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
NAME="libjson-path-perl"
PERL_VENDORLIB="/usr/share/perl5"
else
NAME="perl-JSON-Path"
if [ "${{ matrix.distrib }}" = "el8" ]; then
VERSION="0.5" # https://github.com/centreon/centreon-plugins/issues/4540
PERL_VENDORLIB="/usr/local/share/perl5"
else
PERL_VENDORLIB="/usr/local/share/perl5/$PERL_VERSION"
fi
fi
sed -i "s/@NAME@/$NAME/g" dependencies/perl-json-path/perl-json-path.yaml
sed -i "s/@VERSION@/$VERSION/g" dependencies/perl-json-path/perl-json-path.yaml
sed -i "s#@PERL_VENDORLIB@#$PERL_VENDORLIB#g" dependencies/perl-json-path/perl-json-path.yaml
cat dependencies/perl-json-path/perl-json-path.yaml
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "dependencies/perl-json-path/perl-json-path.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
release: 3
arch: all
commit_hash: ${{ github.sha }}
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
# set condition to true if artifacts are needed
- if: ${{ false }}
name: Upload package artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: packages-${{ matrix.distrib }}
path: ./*.${{ matrix.package_extension}}
retention-days: 1
deliver-rpm:
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [el8, el9]
name: Deliver ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Delivery
uses: ./.github/actions/rpm-delivery
with:
module_name: perl-json-path
distrib: ${{ matrix.distrib }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
cache_key: cache-${{ github.sha }}-rpm-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
stability: ${{ needs.get-environment.outputs.stability }}
deliver-deb:
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [bullseye, bookworm, jammy]
name: Deliver ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Delivery
uses: ./.github/actions/deb-delivery
with:
module_name: perl-json-path
distrib: ${{ matrix.distrib }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
cache_key: cache-${{ github.sha }}-deb-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
stability: ${{ needs.get-environment.outputs.stability }}
promote:
needs: [get-environment]
if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [el8, el9, bullseye, bookworm]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Promote ${{ matrix.distrib }} to stable
uses: ./.github/actions/promote-to-stable
with:
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
module: perl-json-path
distrib: ${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}