Skip to content

Commit c5e3dea

Browse files
CI: Add version input
1 parent e724349 commit c5e3dea

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
workflow_dispatch:
77
workflow_call:
8+
inputs:
9+
version:
10+
description: Version Number
11+
required: false
812

913
jobs:
1014
Lint:
@@ -122,7 +126,13 @@ jobs:
122126
- name: Build for ${{ matrix.name }}
123127
run: |
124128
CROSS_PREFIX="${{ env.cross_dir }}/${{ matrix.triplet }}/bin/${{ matrix.triplet }}-"
125-
make STATIC=1 CROSS_PREFIX="$CROSS_PREFIX"
129+
VERSION="${{ inputs.version }}"
130+
131+
if [ -n "$VERSION" ]; then
132+
make STATIC=1 CROSS_PREFIX="$CROSS_PREFIX" VERSION="$VERSION"
133+
else
134+
make STATIC=1 CROSS_PREFIX="$CROSS_PREFIX"
135+
fi
126136
- name: Upload ${{ matrix.name }}
127137
uses: actions/upload-artifact@v4
128138
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
inputs:
77
version:
8-
description: 'Version Number'
8+
description: Version Number
99
required: true
1010

1111
jobs:

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ STRIP=$(CROSS_PREFIX)strip
55
override CFLAGS+=-O3 -std=c99 -pedantic -Wall -Wextra
66
override LDFLAGS+=-lnetfilter_queue -lnfnetlink -lmnl
77

8+
ifdef VERSION
9+
override CFLAGS += -DVERSION=\"$(VERSION)\"
10+
endif
11+
812
PREFIX=/usr/local
913
BINDIR=$(PREFIX)/bin
1014
BUILDDIR=build

src/fakehttp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
#include <linux/netfilter/nfnetlink_queue.h>
3838
#include <libnetfilter_queue/libnetfilter_queue.h>
3939

40-
#define VERSION "0.9.2"
40+
#ifndef VERSION
41+
#define VERSION "dev"
42+
#endif /* VERSION */
4143

4244
#define E(...) logger(__func__, __FILE__, __LINE__, __VA_ARGS__)
4345

0 commit comments

Comments
 (0)