Skip to content

Commit 06c115a

Browse files
authored
Follow Security Guide to update YAML files. (#188)
1 parent 8ba052a commit 06c115a

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
git config --global user.name ${{ github.actor }}
2525
git config --global user.email ${{ github.actor }}@users.noreply.github.com
2626
- name: create a new branch that references commit id
27-
run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }}
27+
env:
28+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
29+
COMMIT_ID: ${{ github.event.inputs.commit_id }}
30+
run: git checkout -b "$VERSION_NUMBER" "$COMMIT_ID"
2831
- name: Generate SBOM
2932
uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
3033
with:
@@ -38,15 +41,20 @@ jobs:
3841
git commit -m 'Update SBOM'
3942
git push -u origin "$VERSION_NUMBER"
4043
- name: Tag Commit and Push to remote
44+
env:
45+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
4146
run: |
42-
git tag ${{ github.event.inputs.version_number }} -a -m "coreHTTP Library ${{ github.event.inputs.version_number }}"
47+
git tag "$VERSION_NUMBER" -a -m "coreHTTP Library $VERSION_NUMBER"
4348
git push origin --tags
4449
- name: Verify tag on remote
50+
env:
51+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
52+
COMMIT_ID: ${{ github.event.inputs.commit_id }}
4553
run: |
46-
git tag -d ${{ github.event.inputs.version_number }}
54+
git tag -d "$VERSION_NUMBER"
4755
git remote update
48-
git checkout tags/${{ github.event.inputs.version_number }}
49-
git diff ${{ github.event.inputs.commit_id }} tags/${{ github.event.inputs.version_number }}
56+
git checkout tags/"$VERSION_NUMBER"
57+
git diff "$COMMIT_ID" tags/"$VERSION_NUMBER"
5058
create-zip:
5159
needs: tag-commit
5260
name: Create ZIP and verify package for release asset.
@@ -71,13 +79,15 @@ jobs:
7179
zip -r coreHTTP-"$VERSION_NUMBER".zip coreHTTP -x "*.git*"
7280
ls ./
7381
- name: Validate created ZIP
82+
env:
83+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
7484
run: |
7585
mkdir zip-check
76-
mv coreHTTP-${{ github.event.inputs.version_number }}.zip zip-check
86+
mv coreHTTP-"$VERSION_NUMBER".zip zip-check
7787
cd zip-check
78-
unzip coreHTTP-${{ github.event.inputs.version_number }}.zip -d coreHTTP-${{ github.event.inputs.version_number }}
79-
ls coreHTTP-${{ github.event.inputs.version_number }}
80-
diff -r -x "*.git*" coreHTTP-${{ github.event.inputs.version_number }}/coreHTTP/ ../coreHTTP/
88+
unzip coreHTTP-"$VERSION_NUMBER".zip -d coreHTTP-"$VERSION_NUMBER"
89+
ls coreHTTP-"$VERSION_NUMBER"
90+
diff -r -x "*.git*" coreHTTP-"$VERSION_NUMBER"/coreHTTP/ ../coreHTTP/
8191
cd ../
8292
- name: Build
8393
env:
@@ -91,8 +101,10 @@ jobs:
91101
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
92102
make -C build/ all
93103
- name: Test
104+
env:
105+
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
94106
run: |
95-
cd zip-check/coreHTTP-${{ github.event.inputs.version_number }}/coreHTTP/build/
107+
cd zip-check/coreHTTP-"$VERSION_NUMBER"/coreHTTP/build/
96108
ctest -E system --output-on-failure
97109
cd ..
98110
- name: Create artifact of ZIP

0 commit comments

Comments
 (0)