Skip to content

Commit 41f3530

Browse files
committed
Normalize windows package name and strip version number from git tag
Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent c7b3d41 commit 41f3530

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

.github/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
1717
fi
1818
else
1919
BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
20-
if [ "$BRANCH" != "master" ]; then
20+
if [ "$GITHUB_REF_TYPE" == "tag" ] && [[ "$BRANCH" =~ ^[0-9]+\.[0-9]+\.[0-9]+(.+)$ ]]; then
21+
SUFFIX="${BASH_REMATCH[1]}"
22+
elif [ "$BRANCH" != "master" ]; then
2123
SUFFIX="$BRANCH"
2224
fi
2325
fi

.github/workflows/windows.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,25 @@ jobs:
3838
steps:
3939
- name: Checkout
4040
uses: actions/checkout@v6
41-
- name: Package name
41+
- name: Package suffix
4242
shell: bash
4343
run: |
44-
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_name }}" == "master" ]]; then
45-
SUFFIX=""
46-
elif [[ "${{ github.event_name }}" == "push" ]]; then
47-
SUFFIX="-${{ github.ref_name }}"
48-
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "master" ]]; then
49-
SUFFIX="-pr${{ github.event.number }}"
50-
else
51-
SUFFIX="-${{ github.base_ref }}-pr${{ github.event.number }}"
44+
if [[ "${{ github.event_name }}" == "push" ]]; then
45+
if [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(.+)$ ]]; then
46+
SUFFIX="${BASH_REMATCH[1]}"
47+
elif [[ "${{ github.ref_name }}" != "master" ]]; then
48+
SUFFIX="-${{ github.ref_name }}"
49+
fi
50+
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
51+
if [[ "${{ github.base_ref }}" == "master" ]]; then
52+
SUFFIX="-pr${{ github.event.number }}"
53+
else
54+
SUFFIX="-${{ github.base_ref }}-pr${{ github.event.number }}"
55+
fi
5256
fi
53-
echo "DIST_SUFFIX=${{ matrix.configuration == 'Light' && '-Light' || '' }}${SUFFIX}" >> $GITHUB_ENV
57+
PACKAGE_SUFFIX="${{ matrix.configuration == 'Light' && '-Light' || '' }}${SUFFIX}"
58+
sed -i.bak "s/^PACKAGE_SUFFIX=\([-~]*[0-9a-zA-Z]*\)$/PACKAGE_SUFFIX=$PACKAGE_SUFFIX/g" VERSION.mk
59+
cat VERSION.mk
5460
- name: Install CPDK
5561
run: choco install windows-cryptographic-provider-development-kit -y > $null
5662
- name: Setup dev env

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ChangeLog
6464
.cache
6565
compile_commands.json
6666
.dirstamp
67+
VERSION.mk.bak
6768

6869
doc/tools/*-tool
6970
doc/tools/eidenv

win32/Make.rules.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ MINIDRIVER_DEF = /DENABLE_MINIDRIVER
1818
WIXFLAGS = -d ENABLE_MINIDRIVER $(WIXFLAGS)
1919

2020
#Build MSI with the Windows Installer XML (WIX) toolkit
21-
MSI_NAME = $(PRODUCT_NAME)-$(PACKAGE_VERSION_MAJOR).$(PACKAGE_VERSION_MINOR).$(PACKAGE_VERSION_FIX)_$(PLATFORM)$(DIST_SUFFIX).msi
21+
MSI_NAME = $(PRODUCT_NAME)-$(PACKAGE_VERSION_MAJOR).$(PACKAGE_VERSION_MINOR).$(PACKAGE_VERSION_FIX)$(PACKAGE_SUFFIX)_$(PLATFORM).msi
2222
!IF "$(WIX_PACKAGES)" == ""
2323
WIX_PACKAGES = $(TOPDIR)\win32\packages
2424
WIX_VERSION = 6.0.2

0 commit comments

Comments
 (0)