22# Distributed under the Boost Software License, Version 1.0.
33# https://www.boost.org/LICENSE_1_0.txt
44
5+ permissions :
6+ contents : write
7+
58on :
69 push :
710 tags :
@@ -14,12 +17,10 @@ jobs:
1417 release :
1518 name : Create Release
1619 runs-on : ubuntu-latest
17- permissions :
18- contents : write
1920 env :
2021 DEP_DIR : ${{github.workspace}}/dependencies
2122 steps :
22- - uses : actions/checkout@v4
23+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2324 - name : Extract tag name and matching commit on standalone branch
2425 id : get_tag
2526 run : |
@@ -33,18 +34,27 @@ jobs:
3334 echo "tag=v$version" >> $GITHUB_OUTPUT
3435 SOURCE_SHA=$(git rev-parse origin/develop)
3536 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
37+ standalone_commit=0
38+ # Search standalone branch for last 10 more commits if the current one isn't found
39+ for i in {0..10}; do
40+ curSha=$(git rev-parse --short "${SOURCE_SHA}~${i}")
41+ # Find matching standalone commit hash
42+ standalone_commit_matches=$(git log origin/standalone --format="%H" --grep="^Source commit: $curSha\$")
43+ if ! count=$(grep -c . <<<"$standalone_commit_matches"); then
44+ echo "WARN: Did not found source commit for $curSha ($i)"
45+ elif [[ $count -ne 1 ]]; then
46+ echo "ERROR: Found more than 1 related commit for $curSha ($i): $standalone_commit_matches"
47+ exit
48+ else
49+ standalone_commit=$curSha
50+ fi
51+ done;
52+ if [[ $standalone_commit == "0" ]]; then
4053 echo "ERROR: Did not found source commit for $SOURCE_SHA"
4154 exit 1
42- elif [[ $count -ne 1 ]]; then
43- echo "ERROR: Found more than 1 related commit: $standalone_commit_matches"
44- exit 1
4555 fi
4656 echo "source_commit=$SOURCE_SHA" >> $GITHUB_OUTPUT
47- echo "standalone_commit=$standalone_commit_matches " >> $GITHUB_OUTPUT
57+ echo "standalone_commit=$standalone_commit " >> $GITHUB_OUTPUT
4858 - name : Sanity check version
4959 run : |
5060 version=${{steps.get_tag.outputs.tag}}
@@ -110,7 +120,7 @@ jobs:
110120 version=${{steps.get_tag.outputs.tag}}
111121 tag_name=standalone-$version
112122 git tag -a "$tag_name" "${{steps.get_tag.outputs.standalone_commit}}" \
113- -m "Standalone version for v $version" \
123+ -m "Standalone version for $version" \
114124 -m "Source-Commit: ${{steps.get_tag.outputs.source_commit}}"
115125 git show "$tag_name"
116126 if [[ "{{github.event_name}}" == "push" ]]; then
@@ -119,7 +129,7 @@ jobs:
119129
120130 - name : Create Release
121131 if : github.event_name == 'push'
122- uses : softprops/action-gh-release@v2
132+ uses : softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
123133 env :
124134 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
125135 with :
0 commit comments