File tree Expand file tree Collapse file tree 6 files changed +38
-11
lines changed
Expand file tree Collapse file tree 6 files changed +38
-11
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ name: release
44
55on :
66 push :
7- tags : [ "v[0-9]+ *" ]
7+ tags : [ "v*" ]
88 branches :
99 - main
1010
Original file line number Diff line number Diff line change 1- ## 0.1.0
1+ ## 0.1.0~ tech_preview
22
3- Initial alpha release.
3+ Initial technical preview release.
4+
5+ This is not an alpha or beta stability commitment.
6+ The distro may not work correctly in all environments and may affect the behavior of the monitored application.
Original file line number Diff line number Diff line change @@ -18,7 +18,12 @@ endforeach()
1818include (otel_read_properties )
1919otel_read_properties ("../../project.properties" "_PROJECT_PROPERTIES_" )
2020
21- set (_PROJECT_PROPERTIES_VERSION_SHORT ${_PROJECT_PROPERTIES_VERSION} )
21+ # Keep only the numeric prefix for project(VERSION ...), e.g. 1.2.3 from 1.2.3~tech_preview.
22+ string (REGEX MATCH "^[0-9]+(\\ .[0-9]+)?(\\ .[0-9]+)?(\\ .[0-9]+)?" _PROJECT_PROPERTIES_VERSION_SHORT "${_PROJECT_PROPERTIES_VERSION} " )
23+
24+ if (NOT _PROJECT_PROPERTIES_VERSION_SHORT)
25+ message (FATAL_ERROR "Invalid project version for CMake project(VERSION ...): ${_PROJECT_PROPERTIES_VERSION} " )
26+ endif ()
2227
2328if (NOT DEFINED ENV{BUILDING_CONAN_DEPENDENCIES_ONLY})
2429 if (DEFINED ENV{GITHUB_SHA})
Original file line number Diff line number Diff line change 1- version =0.1.0
1+ version =0.1.0~tech_preview
22supported_php_versions =(81 82 83 84)
33supported_package_types =(apk deb rpm)
44test_all_php_versions_with_package_type =deb
Original file line number Diff line number Diff line change @@ -71,6 +71,21 @@ if [[ -z "${PACKAGE_VERSION+x}" ]] || [[ -z "${BUILD_ARCHITECTURE+x}" ]] || [[ -
7171 exit 1
7272fi
7373
74+ sanitize_package_version_for_type () {
75+ local version=" ${1:? } "
76+ local pkg_type=" ${2:? } "
77+
78+ case " ${pkg_type} " in
79+ " deb" )
80+ # Debian version field does not allow underscore characters.
81+ echo " ${version// _/ .} "
82+ ;;
83+ * )
84+ echo " ${version} "
85+ ;;
86+ esac
87+ }
88+
7489test_package () {
7590 local highest_supported_php_version_no_dot=$( get_array_max_value ${_PROJECT_PROPERTIES_SUPPORTED_PHP_VERSIONS} )
7691 local PHP_VERSION=$( convert_no_dot_to_dot_separated_version " ${highest_supported_php_version_no_dot} " )
162177echo " Running on platform ${DOCKER_PLATFORM} " ;
163178
164179mkdir -p " ${PWD} /build/packages"
165- envsubst < packaging/nfpm.yaml > ${PWD} /build/packages/nfpm.yaml
166180
167181for pkg_type in " ${PACKAGE_TYPES[@]} "
168182do
183+ EFFECTIVE_PACKAGE_VERSION=" $( sanitize_package_version_for_type " ${PACKAGE_VERSION} " " ${pkg_type} " ) "
184+
169185 echo " Building package type: ${pkg_type} "
186+ echo " Effective package version for ${pkg_type} : ${EFFECTIVE_PACKAGE_VERSION} "
187+
188+ PACKAGE_VERSION=" ${EFFECTIVE_PACKAGE_VERSION} " envsubst < packaging/nfpm.yaml > ${PWD} /build/packages/nfpm.yaml
170189
171190 docker run --rm \
172191 --platform ${DOCKER_PLATFORM} \
173- -e PACKAGE_VERSION=" ${PACKAGE_VERSION } " \
192+ -e PACKAGE_VERSION=" ${EFFECTIVE_PACKAGE_VERSION } " \
174193 -e BUILD_ARCHITECTURE=" ${BUILD_ARCHITECTURE} " \
175194 -e PACKAGE_GOARCHITECTURE=" ${PACKAGE_GOARCHITECTURE} " \
176195 -e PACKAGE_SHA=" ${PACKAGE_SHA} " \
Original file line number Diff line number Diff line change @@ -58,8 +58,8 @@ find_previous_release_tag() {
5858 local release_tag=" $1 "
5959 local changelog_file=" $2 "
6060
61- # Extract version numbers, ignoring the anchor tags
62- grep -E " ^## [0-9]+\.[0-9]+\.[0-9]+ " " $changelog_file " | sed ' s/^## \([0-9]\+\.[0-9] \+\.[0-9] \+\).*/\1/' | sort -rV | grep -A 1 " ^$release_tag " | tail -n 1
61+ # Extract the first token after "## " as the release version.
62+ grep -E " ^## " " $changelog_file " | sed ' s/^##[[:space:]] \+\([^[:space:]] \+\).*/\1/' | sort -rV | grep -A 1 " ^$release_tag $ " | tail -n 1
6363}
6464
6565extract_release_notes () {
@@ -70,8 +70,8 @@ extract_release_notes() {
7070 local next_section_found=0
7171
7272 while IFS= read -r line; do
73- # Check if we've found a new version section with anchor
74- if [[ " $line " =~ ^# #\ ([0-9]+\.[0-9]+\.[0-9 ]+) ]]; then
73+ # Check if we've found a new version section and read version token.
74+ if [[ " $line " =~ ^# #[[:space:]]+([^[:space:] ]+) ]]; then
7575 current_version= " ${BASH_REMATCH[1]} "
7676
7777 # If we found our target version
You can’t perform that action at this time.
0 commit comments