-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.gitlab-ci.yml
55 lines (53 loc) · 2.34 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
54
55
build-package:
image: registry.gitlab.com/tuxedocomputers/development/installation-testing/docker-images/debian-fai-package-builder:latest
variables:
PACKAGE_BASE_REPO_URL: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages"
before_script:
- apt-get update
- apt-get install -yqq libtoml-perl libfile-slurp-perl
# Extract the current version from debian/changelog
- VERSIONSTRING=$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')
- "echo \"Current version: $VERSIONSTRING\""
- BASE_VERSION=$(echo "$VERSIONSTRING" | awk -F- '{print $1}')
# Check if its tagged
- |
if [ "$CI_COMMIT_BRANCH" == "$CI_COMMIT_REF_NAME" ]; then
# If the current version is not in a tag, create a test version
BRANCH_SHORT=$(echo "$CI_COMMIT_BRANCH" | awk -F- '{print $1}')
TIMESTAMP=$(date -d "$CI_COMMIT_TIMESTAMP" +"%Y%m%d-%H%M%S")
TEST_VERSION="$BASE_VERSION-test-$TIMESTAMP-$BRANCH_SHORT"
echo "Using test version: $TEST_VERSION"
# Update the changelog with the new test version number
commit_hash=$(git log -1 --pretty="%H" -- debian/changelog)
export DEBEMAIL="tux@tuxedocomputers.com"
git checkout "$CI_COMMIT_BRANCH"
gbp dch --verbose --debian-branch "$CI_COMMIT_BRANCH" --new-version $TEST_VERSION --since="$commit_hash"
# Update the VERSIONSTRING with the test version
VERSIONSTRING=$TEST_VERSION
else
echo "Version $VERSIONSTRING will be packaged."
fi
script:
- ./build.sh
- head -5 src/tuxedo-tomte
- ls debian
- cat debian/install
- cd ..
- |
for deb_file in *.deb; do
version="${deb_file#*_}"
version="${version%%_*}"
package="${deb_file%%_*}"
echo "$deb_file : $package $version"
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "$deb_file" "$PACKAGE_BASE_REPO_URL/generic/$package/$version/$deb_file"
done
rules:
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
check:
script:
- apt-get update
- apt-get install -yqq libparse-edid-perl packagekit-tools perl libfile-fcntllock-perl libdpkg-perl libjson-perl libconfig-tiny-perl libintl-perl libtoml-perl libfile-slurp-perl
- ./check.sh
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE != "merge_request_event"