From f2ae61c2b3ddf69d15654f0048c546e145c1abd1 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Thu, 23 Mar 2023 03:23:05 -0700 Subject: [PATCH] Update release tagging using publish action. --- .github/workflows/main.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a1f8e30a5a..8db5e5cb60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 "surelog-dev+bot@chipsalliance.org" + # 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