-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
54 lines (50 loc) · 1.77 KB
/
.gitlab-ci.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
stages:
- build
- release
build:
stage: build
image: cern/alma9-base:latest
before_script:
- yum install -y rpm-build python3 python3-devel git
script:
- |
export CI_COMMIT_TAG=$(git describe --tags --abbrev=0)
sed -i "s/Version:.*/Version: $CI_COMMIT_TAG/" info-exporter.spec
mkdir -p rpmbuild/{SOURCES,SPECS,BUILD,RPMS,SRPMS}
cp info-exporter.spec rpmbuild/SPECS/
mkdir info-exporter-build
cp info-exporter info-exporter-build/
cp info-exporter-15s.service info-exporter-build/
cp info-exporter-60s.service info-exporter-build/
cp config-15s.json info-exporter-build/
cp config-60s.json info-exporter-build/
cp name_map_gen info-exporter-build/
cp README.md info-exporter-build/
cp request.json info-exporter-build/
tar --create --file rpmbuild/SOURCES/info-exporter-$CI_COMMIT_TAG.tar.gz -C info-exporter-build .
rpmbuild --define "_topdir `pwd`/rpmbuild" --target noarch -bb /builds/tgalpin/cables-info-exporter/rpmbuild/SPECS/info-exporter.spec
mv rpmbuild/RPMS/noarch/*.rpm .
artifacts:
paths:
- ./*.rpm
only:
- master
- tags
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: build
artifacts: true
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
- ls
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: 'Release $CI_COMMIT_TAG'
assets:
links:
- name: 'Project RPM'
url: 'https://gitlab.cern.ch/tgalpin/cables-info-exporter/-/jobs/artifacts/master/download?job=build'