Skip to content

Commit

Permalink
Adding support with versioning for non snapshot builds
Browse files Browse the repository at this point in the history
Signed-off-by: Yariv Rachmani <[email protected]>
  • Loading branch information
Yarboa committed Dec 14, 2023
1 parent 9d2a590 commit 4c998f9
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ update_release: false
srpm_build_deps:
- make

actions:
post-upstream-clone:
- bash -c 'git config --global --add safe.directory $(pwd)'
- bash -c './build-scripts/create-spec.sh'

get-current-version:
- bash -c './build-scripts/version.sh'

jobs:
- job: copr_build
trigger: pull_request
Expand Down
14 changes: 14 additions & 0 deletions build-scripts/create-spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -xe
# SPDX-License-Identifier: LGPL-2.1-or-later

VERSION_SCRIPT=$(dirname "$(readlink -f "$0")")/version.sh

VERSION="$(${VERSION_SCRIPT} short)"
RELEASE="$(${VERSION_SCRIPT} release)"

# Set version and release
sed \
-e "s|@VERSION@|${VERSION}|g" \
-e "s|@RELEASE@|${RELEASE}|g" \
< initoverlayfs.spec.in \
> initoverlayfs.spec
29 changes: 29 additions & 0 deletions build-scripts/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -e
# SPDX-License-Identifier: LGPL-2.1-or-later

# Current version of initoverlayfs
VERSION=0.98
# Specify if build is a official release or a snapshot build
IS_RELEASE=false
# Used for official releases. Increment if necessary
RELEASE="1"

function short(){
echo ${VERSION}
}

function long(){
echo "$(short)-$(release)"
}

function release(){
# Package release

if [ $IS_RELEASE = false ]; then
# Used for nightly builds
RELEASE="0.$(date +%04Y%02m%02d%02H%02M).git$(git rev-parse --short ${GITHUB_SHA:-HEAD})"
fi
echo $RELEASE
}

[ -z $1 ] && short || $1
5 changes: 2 additions & 3 deletions initoverlayfs.spec → initoverlayfs.spec.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Name: initoverlayfs
Version: 0.98
Release: 1%{?dist}
Version: @VERSION@
Release: @RELEASE@%{?dist}
Summary: An initial scalable filesystem for Linux operating systems

License: GPL-2.0-only
URL: https://github.com/containers/initoverlayfs
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Expand Down

0 comments on commit 4c998f9

Please sign in to comment.