Skip to content

Commit

Permalink
Update release tagging using publish action.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzeller committed Mar 23, 2023
1 parent 71dc59f commit f2ae61c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,20 +1053,33 @@ jobs:

- name: Tag with CMake version if not already.
run: |
git config --local user.name "Development bot"
git config --local user.email "[email protected]"
# We want to tag whenever the cmake version changes. So extract the
# hash of when the current version was entered.
read TAG_HASH TAG_VERSION <<<$(git annotate -l CMakeLists.txt | sed 's/\(^[0-9A-Fa-f]\+\).*project(SURELOG VERSION \([0-9]\+\.[0-9]\+\).*/\1 \2/p;d')
echo "Surelog Version v${TAG_VERSION} at hash ${TAG_HASH}"
TAG="v${TAG_VERSION}"
echo "Surelog Version ${TAG} at hash ${TAG_HASH}"
# If this is the first time we see this tag: apply.
if [ -z "$(git tag -l "v${TAG_VERSION}")" ]; then
git tag -a "v${TAG_VERSION}" ${TAG_HASH} -m "Update to v${TAG_VERSION}"
git push origin "v${TAG_VERSION}"
if [ -z "$(git tag -l "${TAG}")" ]; then
git tag -a "${TAG}" ${TAG_HASH} -m "Update to ${TAG}"
echo "TAG=$TAG" >> $GITHUB_ENV
else
echo "Tag already applied"
fi
- name: Publish tag
if: ${{ env.TAG != '' }}
# For now, just publish tag, but we can also use this to
# publish the binaries we built before.
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.TAG }}

# Code formatting
CodeFormatting:
runs-on: ubuntu-20.04
Expand Down

0 comments on commit f2ae61c

Please sign in to comment.