1919 env :
2020 DEP_DIR : ${{github.workspace}}/dependencies
2121 steps :
22- - uses : actions/checkout@v4
22+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2323 - name : Extract tag name and matching commit on standalone branch
2424 id : get_tag
2525 run : |
@@ -33,18 +33,27 @@ jobs:
3333 echo "tag=v$version" >> $GITHUB_OUTPUT
3434 SOURCE_SHA=$(git rev-parse origin/develop)
3535 fi
36- SOURCE_SHA=$(git rev-parse --short "$SOURCE_SHA")
37- # Find matching standalone commit hash
38- standalone_commit_matches=$(git log origin/standalone --format="%H" --grep="^Source commit: $SOURCE_SHA\$")
39- if ! count=$(grep -c . <<<"$standalone_commit_matches"); then
36+ standalone_commit=0
37+ # Search standalone branch for last 10 more commits if the current one isn't found
38+ for i in {0..10}; do
39+ curSha=$(git rev-parse --short "${SOURCE_SHA}~${i}")
40+ # Find matching standalone commit hash
41+ standalone_commit_matches=$(git log origin/standalone --format="%H" --grep="^Source commit: $curSha\$")
42+ if ! count=$(grep -c . <<<"$standalone_commit_matches"); then
43+ echo "WARN: Did not found source commit for $curSha ($i)"
44+ elif [[ $count -ne 1 ]]; then
45+ echo "ERROR: Found more than 1 related commit for $curSha ($i): $standalone_commit_matches"
46+ exit
47+ else
48+ standalone_commit=$curSha
49+ fi
50+ done;
51+ if [[ $standalone_commit == "0" ]]; then
4052 echo "ERROR: Did not found source commit for $SOURCE_SHA"
4153 exit 1
42- elif [[ $count -ne 1 ]]; then
43- echo "ERROR: Found more than 1 related commit: $standalone_commit_matches"
44- exit 1
4554 fi
4655 echo "source_commit=$SOURCE_SHA" >> $GITHUB_OUTPUT
47- echo "standalone_commit=$standalone_commit_matches " >> $GITHUB_OUTPUT
56+ echo "standalone_commit=$standalone_commit " >> $GITHUB_OUTPUT
4857 - name : Sanity check version
4958 run : |
5059 version=${{steps.get_tag.outputs.tag}}
@@ -110,7 +119,7 @@ jobs:
110119 version=${{steps.get_tag.outputs.tag}}
111120 tag_name=standalone-$version
112121 git tag -a "$tag_name" "${{steps.get_tag.outputs.standalone_commit}}" \
113- -m "Standalone version for v $version" \
122+ -m "Standalone version for $version" \
114123 -m "Source-Commit: ${{steps.get_tag.outputs.source_commit}}"
115124 git show "$tag_name"
116125 if [[ "{{github.event_name}}" == "push" ]]; then
@@ -119,7 +128,7 @@ jobs:
119128
120129 - name : Create Release
121130 if : github.event_name == 'push'
122- uses : softprops/action-gh-release@v2
131+ uses : softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
123132 env :
124133 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
125134 with :
0 commit comments