Skip to content

Commit

Permalink
Update release yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot committed Jul 11, 2024
1 parent 560850c commit 596f6f7
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
# Some library use different name for library and repository. Version number may use library_name in source file.
library_name: "FreeRTOS+TCP"
# Source folder list for version number updates
source_folder_list: "source test"
source_folder_list: "source test tools"

jobs:
clean-existing-tag-and-release:
Expand Down Expand Up @@ -75,13 +75,14 @@ jobs:

- name: Update version number in source files
run: |
echo "${{ env.source_folder_list }}" | \
xargs -n 1 sh -c \
'find $1 -type f \( -name "*.c" -o -name "*.h" \) \
-exec sed -i -b -E "0,/^ \* ${{ env.library_name }}/s/^ \* ${{ env.library_name }}.*/ \* ${{ env.library_name }} ${{ github.event.inputs.version_number }}/g" {} +'
git add .
git commit -m '[AUTO][RELEASE]: Update version number in source files'
git push -u origin ${{ github.event.inputs.version_number }}
LIBRARY_NAME_REGEX=$( echo ${{ env.library_name }} | sed 's/\+/\\+/g' )
echo "${{ env.source_folder_list }}" | \
xargs -n 1 sh -c \
'find $1 -type f \( -name "*.c" -o -name "*.h" \) \
-exec sed -i -b -E "0,/^ \* $LIBRARY_NAME_REGEX/s/^ \* $LIBRARY_NAME_REGEX.*/ \* ${{ env.library_name }} ${{ github.event.inputs.version_number }}/g" {} +'
git add .
git commit -m '[AUTO][RELEASE]: Update version number in source files'
git push -u origin ${{ github.event.inputs.version_number }}
- name : Update version number in manifest.yml
run: |
Expand Down Expand Up @@ -178,9 +179,9 @@ jobs:
# Compare the <version_number> with input version number in files in SOURCE_FILE_LIST
echo $SOURCE_FILE_WITH_VERSION_LIST | xargs -I{} sh -c \
'grep -x " \* ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }}" {} && \
echo {} : match ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }} || \
{ echo "{} : ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }'
'grep -x " \* ${{ env.library_name }} ${{ github.event.inputs.version_number }}" {} && \
echo {} : match ${{ env.library_name }} ${{ github.event.inputs.version_number }} || \
{ echo "{} : ${{ env.library_name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }'
- name: Check version number in doxygen
run: |
Expand Down Expand Up @@ -219,6 +220,19 @@ jobs:
&& echo "core_mqtt.h : match ${{ github.event.inputs.version_number }}" \
|| { echo "core_mqtt.h : $MACRO_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; }
- name: Check FreeRTOS-Plus-TCP version number macro in header file
if: ${{ github.event.repository.name == 'FreeRTOS-Plus-TCP' }}
run: |
cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }}
# find "#define ipFR_TCP_VERSION_NUMBER <version_number>" in source/include/FreeRTOS_IP.h
MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*ipFR_TCP_VERSION_NUMBER[ ]*\".*\"[ ]*" source/include/FreeRTOS_IP.h | awk '{gsub("\"","",$3); print $3 }');
# compare the <version_number> with input version number
[[ $MACRO_VERSION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \
&& echo "core_mqtt.h : match ${{ github.event.inputs.version_number }}" \
|| { echo "core_mqtt.h : $MACRO_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; }
- name: Build
run: |
cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }}
Expand Down Expand Up @@ -289,6 +303,7 @@ jobs:
asset_path: ./${{ env.repository_zip_name }}
asset_name: ${{ env.repository_zip_name }}
asset_content_type: application/zip

cleanup:
needs:
- create-release
Expand Down

0 comments on commit 596f6f7

Please sign in to comment.