Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish pre-release on develop push #73

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
mv nzbget-osx-installers/* builds
cd builds
VERSION=$(ls | grep bin-windows-setup | cut -d - -f 2)
if [ "$GITHUB_REF_NAME" != "main" ]; then VERSION="$VERSION-testing"; fi
SIGS_FILE="nzbget-$VERSION.sig.txt"

echo "Generating $SIGS_FILE ..."
Expand Down Expand Up @@ -79,3 +80,36 @@ jobs:
nzbget-windows-installers
nzbget-linux-installers
nzbget-osx-installers

make-testing-release:
runs-on: ubuntu-latest
needs: [generate-signatures]
permissions:
contents: write
if: github.ref_name == 'develop'
steps:

- name: Download build artifacts
uses: actions/download-artifact@v3

- name: Create latest artifacts
run: |
cp $(find nzbget-installers/ -name *linux.run) nzbget-installers/nzbget-latest-testing-bin-linux.run
cp $(find nzbget-installers/ -name *windows-setup.exe) nzbget-installers/nzbget-latest-testing-bin-windows-setup

- name: Delete tag and release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: testing
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Make release
uses: ncipollo/release-action@v1
with:
artifacts: "nzbget-installers/*"
generateReleaseNotes: true
tag: testing
allowUpdates: true
prerelease: true
20 changes: 20 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,33 @@ jobs:
with:
fetch-depth: 0

- name: Change version for non-release
if: github.ref_name != 'main'
run: |
VERSION=$(cat configure.ac | grep AC_INIT | cut -d , -f 2 | xargs)
NEW_VERSION="$VERSION-testing-$(date '+%Y%m%d')"
sed -e "s|AC_INIT(nzbget.*|AC_INIT(nzbget, $NEW_VERSION, https://github.com/nzbgetcom/nzbget/issues)|g" -i configure.ac
echo NEW_VERSION=$NEW_VERSION >> $GITHUB_ENV

- name: Build
run: |
rm -rf /build/nzbget
rm -rf /build/output
cp -r . /build/nzbget
cd /build
docker run -e ALL_ARCHS="i686 x86_64 aarch64 armhf armel" -v /build:/build nzbget-build /build/scripts/build-nzbget-ci.sh

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
cd /build/output
NEW_VERSION_FEATURE="$NEW_VERSION-${GITHUB_REF_NAME/\//-}"
for FILE in *.run; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/$NEW_VERSION/$NEW_VERSION_FEATURE}
mv $FILE $NEW_FILE
done

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,29 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Change version for non-release
if: github.ref_name != 'main'
run: |
VERSION=$(cat configure.ac | grep AC_INIT | cut -d , -f 2 | xargs)
NEW_VERSION="$VERSION-testing-$(date '+%Y%m%d')"
sed -e "s|AC_INIT(nzbget.*|AC_INIT(nzbget, $NEW_VERSION, https://github.com/nzbgetcom/nzbget/issues)|g" -i '' configure.ac
echo NEW_VERSION=$NEW_VERSION >> $GITHUB_ENV

- name: Build
run: |
bash osx/build-nzbget.sh
bash osx/build-nzbget.sh

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
cd osx/build/Release
NEW_VERSION_FEATURE="$NEW_VERSION-${GITHUB_REF_NAME/\//-}"
for FILE in *.zip; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/$NEW_VERSION/$NEW_VERSION_FEATURE}
mv $FILE $NEW_FILE
done

- name: Upload build artifacts
uses: actions/upload-artifact@v3
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,30 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Change version for non-release
if: github.ref_name != 'main'
run: |
$Version = ((((Select-String -Path nzbget.vcxproj -Pattern ";VERSION=")[0] -split(';'))[2] -split('='))[1]) -replace '"', ''
$Date=Get-Date -Format "yyyyMMdd"
$NewVersion = "$Version-testing-$Date"
(Get-Content nzbget.vcxproj) | ForEach-Object {$_ -replace "VERSION=`"$Version`"", "VERSION=`"$NewVersion`""} | Set-Content nzbget.vcxproj
(Get-Content windows\nzbget-setup.nsi) | ForEach-Object {$_ -replace "`"DisplayVersion`" `"$Version`"", "`"DisplayVersion`" `"$NewVersion`""} | Set-Content windows\nzbget-setup.nsi
"NEW_VERSION=$NewVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Build
run: |
.\windows\build-nzbget-vs22.bat

- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
$Output="c:\nzbget\build\output"
$NewVersion=$env:NEW_VERSION
$Suffix = $env:GITHUB_REF_NAME.Replace("/","-")
ForEach ($File In Get-ChildItem -Path $Output -Filter "*.exe") {
Rename-Item -Path "$Output\$($File.Name)" -NewName $File.Name.Replace($NewVersion, "$NewVersion-$Suffix")
}

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ ipch/
# NZBGet specific
nzbget
build
code_revision.cpp
*.temp
*.pyc
pytest.ini
Expand Down
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22)

project(
nzbget
VERSION "22.0"
VERSION "22.2"
DESCRIPTION "NZBGet is a binary downloader, which downloads files from Usenet"
LANGUAGES C CXX
)
Expand Down Expand Up @@ -49,12 +49,6 @@ include_directories(lib/regex)
include_directories(${CMAKE_BINARY_DIR})
add_subdirectory(lib)

if (NOT WIN32)
execute_process(COMMAND chmod +x ${CMAKE_SOURCE_DIR}/code_revision.sh)
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/code_revision.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
execute_process(COMMAND mv ${CMAKE_SOURCE_DIR}/code_revision.cpp ${CMAKE_BINARY_DIR})
endif()

if(ENABLE_TESTS)
include(CTest)
add_subdirectory(tests)
Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,14 @@ NZBGet natively supports for multiple platforms and build options, so each platf
4. After merging `develop` -> `main`, must be back merge `main` -> `develop` before any changes in `develop` branch.

This flow results to the fact that in the PR to master branch we see only the squashed commits that correspond to the PRs in the develop branch in current release cycle.

### Version changes in release cycle

After the release has been published (from the `main` branch), the minor version in the `develop` branch should be increased so that subsequent test builds are a higher version than the release.

List of files to change version:

1. configure.ac - "AC_INIT" macro
2. CMakeLists.txt - "project" block
3. nzbget.vcxproj - "PreprocessorDefinitions" blocks - 4 matches
4. windows/nzbget-setup.nsi - WriteRegStr - "DisplayVersion"
56 changes: 1 addition & 55 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ nzbget_SOURCES = \
daemon/nserv/NzbGenerator.h \
daemon/nserv/NzbGenerator.cpp \
daemon/nserv/YEncoder.h \
daemon/nserv/YEncoder.cpp \
code_revision.cpp
daemon/nserv/YEncoder.cpp

if WITH_PAR2
nzbget_SOURCES += \
Expand Down Expand Up @@ -455,59 +454,6 @@ install-conf:
uninstall-conf:
rm -f "$(DESTDIR)$(sysconfdir)/nzbget.conf"

# Determining git revision:
# 1) If directory ".git" exists we take revision from git log.
# File is recreated only if revision number was changed.
# 2) If directory ".git" doesn't exists we keep and reuse file "code_revision.cpp",
# which was possibly created early.
# 3) If neither directory ".git" nor file "code_revision.cpp" are available
# we create new file "code_revision.c" with empty revision number.
code_revision.cpp: FORCE
@ if test -d ./.git ; then \
B=`git branch | sed -n -e 's/^\* \(.*\)/\1/p'`; \
M=`git status --porcelain` ; \
if test "$$M" != "" ; then \
M="M" ; \
fi ; \
if test "$$B" = "master" ; then \
V="$$M" ; \
elif test "$$B" = "develop" ; then \
V=`git rev-list HEAD | wc -l | xargs` ; \
V="$${V}$$M" ; \
else \
V=`git rev-list HEAD | wc -l | xargs` ; \
V="$${V}$$M ($$B)" ; \
fi ; \
H=`test -f ./code_revision.cpp && head -n 1 code_revision.cpp`; \
if test "/* $$V */" != "$$H" ; then \
( \
echo "/* $$V */" ;\
echo "/* This file is automatically regenerated on each build. Do not edit it. */" ;\
echo "#include \"nzbget.h\"" ;\
echo "const char* code_revision(void)" ;\
echo "{" ;\
echo " const char* revision = \"$$V\";" ;\
echo " return revision;" ;\
echo "}" ;\
) > code_revision.cpp ; \
fi \
elif test -f ./code_revision.cpp ; then \
test "ok, reuse existing file"; \
else \
( \
echo "/* */" ;\
echo "/* This file is automatically regenerated on each build. Do not edit it. */" ;\
echo "#include \"nzbget.h\"" ;\
echo "const char* code_revision(void)" ;\
echo "{" ;\
echo " const char* revision = \"\";" ;\
echo " return revision;" ;\
echo "}" ;\
) > code_revision.cpp ; \
fi
FORCE:

# Ignore "code_revision.cpp" in distcleancheck
distcleancheck_listfiles = \
find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \
sh '{}' ';'
Expand Down
53 changes: 0 additions & 53 deletions code_revision.sh

This file was deleted.

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.65)
AC_INIT(nzbget, 22.0, https://github.com/nzbgetcom/nzbget/issues)
AC_INIT(nzbget, 22.2, https://github.com/nzbgetcom/nzbget/issues)
AC_CONFIG_AUX_DIR(posix)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign subdir-objects])
Expand Down
17 changes: 1 addition & 16 deletions daemon/util/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
#include "Util.h"
#include "YEncode.h"

#ifndef WIN32
// function "code_revision" is automatically generated in file "code_revision.cpp" on each build
const char* code_revision(void);
#endif

#ifdef WIN32
// getopt for WIN32:
// from http://www.codeproject.com/cpp/xgetopt.asp
Expand Down Expand Up @@ -110,17 +105,7 @@ char Util::VersionRevisionBuf[100];

void Util::Init()
{
#ifndef WIN32
if ((strlen(code_revision()) > 0) && strstr(VERSION, "testing"))
{
snprintf(VersionRevisionBuf, sizeof(VersionRevisionBuf), "%s-r%s", VERSION, code_revision());
}
else
#endif
{
snprintf(VersionRevisionBuf, sizeof(VersionRevisionBuf), "%s", VERSION);
}

snprintf(VersionRevisionBuf, sizeof(VersionRevisionBuf), "%s", VERSION);
// init static vars there
CurrentTicks();
}
Expand Down
8 changes: 4 additions & 4 deletions nzbget.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>C:\vcpkg\installed\x86-windows-static\include;..\bin\Debug32;.\daemon\connect;.\daemon\extension;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nserv;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\lib\yencode;.\windows\resources;.\lib\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.0";_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.2";_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand All @@ -107,7 +107,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>C:\vcpkg\installed\x64-windows-static\include;..\bin\Debug64;.\daemon\connect;.\daemon\extension;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nserv;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\regex;.\lib\par2;.\lib\yencode;.\windows\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.0";_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.2";_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand All @@ -133,7 +133,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>C:\vcpkg\installed\x86-windows-static\include;..\bin\Release32;.\daemon\connect;.\daemon\extension;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nserv;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\lib\yencode;.\windows\resources;.\lib\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.0";NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.2";NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -172,7 +172,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>C:\vcpkg\installed\x64-windows-static\include;..\bin\Release64;.\daemon\connect;.\daemon\extension;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nserv;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\lib\yencode;.\windows\resources;.\lib\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.0";NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="22.2";NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down
4 changes: 0 additions & 4 deletions tests/postprocess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ file(GLOB PostprocessTestsSrc
${CMAKE_SOURCE_DIR}/lib/regex/regex.c
)

if (NOT WIN32)
set(PostprocessTests ${PostprocessTestsSrc} ${CMAKE_BINARY_DIR}/code_revision.cpp)
endif()

add_executable(PostprocessTests ${PostprocessTestsSrc})
target_link_libraries(PostprocessTests PRIVATE
ZLIB::ZLIB
Expand Down
Loading