Skip to content

Commit 9dacd07

Browse files
committed
Create release tags for standalone branch
For each release commit "vX.Y" a "standalone-vX.Y" tag will be created at the corresponding commit on the "standalone" branch.
1 parent 2f0ffbb commit 9dacd07

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019 - 2025 Alexander Grund
1+
# Copyright 2019 - 2026 Alexander Grund
22
# Distributed under the Boost Software License, Version 1.0.
33
# https://www.boost.org/LICENSE_1_0.txt
44

@@ -18,19 +18,33 @@ jobs:
1818
contents: write
1919
env:
2020
DEP_DIR: ${{github.workspace}}/dependencies
21-
BOOST_VERSION: 1.66.0
2221
steps:
2322
- uses: actions/checkout@v4
24-
- name: Extract tag name
23+
- name: Extract tag name and matching commit on standalone branch
2524
id: get_tag
2625
run: |
2726
echo "Running for $GITHUB_EVENT_NAME event"
27+
git fetch origin master develop standalone
2828
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
2929
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
30+
SOURCE_SHA=$(git merge-base "${{github.sha}}" origin/develop)
3031
else
3132
version=$(grep "set(_version " CMakeLists.txt | head -n1 | sed 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
3233
echo "tag=v$version" >> $GITHUB_OUTPUT
34+
SOURCE_SHA=$(git rev-parse origin/develop)
3335
fi
36+
# Find matching standalone commit hash
37+
standalone_commit_matches=$(git log origin/standalone --format="%H" --grep="^Source-Commit: $SOURCE_SHA\$")
38+
if ! count=$(grep -c . <<<"$standalone_commit_matches"); then
39+
echo "ERROR: Did not found source commit for $SOURCE_SHA"
40+
exit 1
41+
elif [[ $count -ne 1 ]]; then
42+
echo "ERROR: Found more than 1 related commit: $standalone_commit_matches"
43+
exit 1
44+
fi
45+
SOURCE_SHA=$(git rev-parse --short "$SOURCE_SHA")
46+
echo "source_commit=$SOURCE_SHA" >> $GITHUB_OUTPUT
47+
echo "standalone_commit=$standalone_commit_matches" >> $GITHUB_OUTPUT
3448
- name: Sanity check version
3549
run: |
3650
version=${{steps.get_tag.outputs.tag}}
@@ -88,6 +102,20 @@ jobs:
88102
mv nowide_standalone.tar.gz nowide_standalone_${{steps.get_tag.outputs.tag}}.tar.gz
89103
mv documentation.tar.gz nowide_docu.tar.gz
90104
105+
- name: Tag standalone branch
106+
run: |
107+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
108+
git config --global user.name "$GITHUB_ACTOR"
109+
version=${{steps.get_tag.outputs.tag}}
110+
tag_name=standalone-$version
111+
git tag -a "$tag_name" "${{steps.get_tag.outputs.standalone_commit}}" \
112+
-m "Standalone version for v$version" \
113+
-m "Source-Commit: ${{steps.get_tag.outputs.source_commit}}"
114+
git show "$tag_name"
115+
if [[ "{{github.event_name}}" == "push" ]]; then
116+
git push origin "$tag_name"
117+
fi
118+
91119
- name: Create Release
92120
if: github.event_name == 'push'
93121
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)