Skip to content

Commit 80918ce

Browse files
committed
Update release actions
1 parent a369c52 commit 80918ce

File tree

1 file changed

+52
-17
lines changed

1 file changed

+52
-17
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,56 @@ jobs:
2020
with:
2121
ref: ${{ github.event.inputs.commit_id }}
2222
- name: Configure git identity
23+
env:
24+
ACTOR: ${{ github.actor }}
2325
run: |
24-
git config --global user.name ${{ github.actor }}
25-
git config --global user.email ${{ github.actor }}@users.noreply.github.com
26+
git config --global user.name "$ACTOR"
27+
git config --global user.email "$ACTOR"@users.noreply.github.com
2628
- name: create a new branch that references commit id
27-
run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }}
29+
env:
30+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
31+
COMMIT_ID: ${{ github.event.inputs.commit_id }}
32+
run: git checkout -b "$VERSION_NUMBER" "$COMMIT_ID"
33+
- name: Update version number in source files
34+
env:
35+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
36+
REPO_NAME: ${{ github.event.repository.name }}
37+
source_folder_list: "source test"
38+
run: |
39+
echo "${{ env.source_folder_list }}" | \
40+
xargs -n 1 sh -c \
41+
'find $1 -type f \( -name "*.c" -o -name "*.h" \) \
42+
-exec sed -i -b -E "0,/^ \* FreeRTOS\+TCP/s/^ \* FreeRTOS\+TCP.*/ \* FreeRTOS\+TCP $VERSION_NUMBER/g" {} +'
43+
git add .
44+
git commit -m '[AUTO][RELEASE]: Update version number in source files'
45+
git push -u origin "$VERSION_NUMBER"
2846
- name: Generate SBOM
2947
uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
3048
with:
3149
repo_path: ./
3250
source_path: ./source
3351
- name: commit SBOM file
52+
env:
53+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
3454
run: |
3555
git add .
3656
git commit -m 'Update SBOM'
37-
git push -u origin ${{ github.event.inputs.version_number }}
57+
git push -u origin "$VERSION_NUMBER"
3858
- name: Tag Commit and Push to remote
59+
env:
60+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
3961
run: |
40-
git tag ${{ github.event.inputs.version_number }} -a -m "FreeRTOS-Plus-TCP Library ${{ github.event.inputs.version_number }}"
62+
git tag "$VERSION_NUMBER" -a -m "FreeRTOS-Plus-TCP Library $VERSION_NUMBER"
4163
git push origin --tags
4264
- name: Verify tag on remote
65+
env:
66+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
67+
COMMIT_ID: ${{ github.event.inputs.commit_id }}
4368
run: |
44-
git tag -d ${{ github.event.inputs.version_number }}
69+
git tag -d "$VERSION_NUMBER"
4570
git remote update
46-
git checkout tags/${{ github.event.inputs.version_number }}
47-
git diff ${{ github.event.inputs.commit_id }} tags/${{ github.event.inputs.version_number }}
71+
git checkout tags/"$VERSION_NUMBER"
72+
git diff "$COMMIT_ID" tags/"$VERSION_NUMBER"
4873
create-zip:
4974
needs: tag-commit
5075
name: Create ZIP and verify package for release asset.
@@ -55,36 +80,44 @@ jobs:
5580
- name: Checkout code
5681
uses: actions/checkout@v4
5782
with:
58-
ref: ${{ github.event.inputs.commit_id }}
83+
ref: ${{ github.event.inputs.version_number }}
5984
path: FreeRTOS-Plus-TCP
6085
submodules: recursive
6186
- name: Checkout disabled submodules
6287
run: |
6388
cd FreeRTOS-Plus-TCP
6489
git submodule update --init --checkout --recursive
6590
- name: Create ZIP
91+
env:
92+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
6693
run: |
67-
zip -r FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}.zip FreeRTOS-Plus-TCP -x "*.git*"
94+
zip -r FreeRTOS-Plus-TCP-"$VERSION_NUMBER".zip FreeRTOS-Plus-TCP -x "*.git*"
6895
ls ./
6996
- name: Validate created ZIP
97+
env:
98+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
7099
run: |
71100
mkdir zip-check
72-
mv FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}.zip zip-check
101+
mv FreeRTOS-Plus-TCP-"$VERSION_NUMBER".zip zip-check
73102
cd zip-check
74-
unzip FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}.zip -d FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}
75-
ls FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}
76-
diff -r -x "*.git*" FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}/FreeRTOS-Plus-TCP/ ../FreeRTOS-Plus-TCP/
103+
unzip FreeRTOS-Plus-TCP-"$VERSION_NUMBER".zip -d FreeRTOS-Plus-TCP-"$VERSION_NUMBER"
104+
ls FreeRTOS-Plus-TCP-"$VERSION_NUMBER"
105+
diff -r -x "*.git*" FreeRTOS-Plus-TCP-"$VERSION_NUMBER"/FreeRTOS-Plus-TCP/ ../FreeRTOS-Plus-TCP/
77106
cd ../
78107
- name: Build
108+
env:
109+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
79110
run: |
80-
cd zip-check/FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}/FreeRTOS-Plus-TCP
111+
cd zip-check/FreeRTOS-Plus-TCP-"$VERSION_NUMBER"/FreeRTOS-Plus-TCP
81112
sudo apt-get install -y lcov
82113
sudo apt-get install unifdef
83114
cmake -S test/unit-test -B test/unit-test/build/
84115
make -C test/unit-test/build/ all
85116
- name: Test
117+
env:
118+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
86119
run: |
87-
cd zip-check/FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}/FreeRTOS-Plus-TCP
120+
cd zip-check/FreeRTOS-Plus-TCP-"$VERSION_NUMBER"/FreeRTOS-Plus-TCP
88121
pushd test/unit-test/build/
89122
ctest -E system --output-on-failure
90123
popd
@@ -147,6 +180,8 @@ jobs:
147180
- name: Checkout code
148181
uses: actions/checkout@v4
149182
- name: Delete branch created for Tag by SBOM generator
183+
env:
184+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
150185
run: |
151186
# Delete the branch created for Tag by SBOM generator
152-
git push -u origin --delete refs/heads/${{ github.event.inputs.version_number }}
187+
git push -u origin --delete refs/heads/"$VERSION_NUMBER"

0 commit comments

Comments
 (0)