From d7dde3fd3eeb892505c0c702f16cfad59317ab98 Mon Sep 17 00:00:00 2001
From: Yaroslav Lobankov <y.lobankov@tarantool.org>
Date: Thu, 11 Jan 2024 11:02:48 +0100
Subject: [PATCH] ci: fix saving build artifacts for osx and freebsd

When `${{ matrix.tarantool-branch}}` is `release/3.0` or similar, the
step to save build artifacts will fail with the following error:

    Error: Artifact name is not valid: osx-13-x86_64-release/3.0-debug.
    Contains the following character:  Forward slash /

This commit fixes the issue.

NO_DOC=ci
NO_TEST=ci
NO_CHANGELOG=ci

(cherry picked from commit 64363b43c877c95fa4a2bd84855ddce77911300d)
---
 .github/workflows/freebsd.yml | 11 ++++++++++-
 .github/workflows/osx.yml     |  8 +++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml
index 64ff845a49..f278e7b840 100644
--- a/.github/workflows/freebsd.yml
+++ b/.github/workflows/freebsd.yml
@@ -47,11 +47,20 @@ jobs:
         with:
           bot-token: ${{ secrets.VKTEAMS_BOT_TOKEN }}
 
+      - name: Calculate short name for Tarantool branch
+        if: failure()
+        run: >
+          echo "SHORT_BRANCH_NAME=$(basename ${{ matrix.tarantool-branch }})" >>
+          $GITHUB_ENV
+
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         if: failure()
         with:
-          name: freebsd-${{ matrix.freebsd-version }}-${{ matrix.tarantool-branch }}
+          name: ${{ format(
+            'freebsd-{0}-{1}',
+            matrix.freebsd-version,
+            env.SHORT_BRANCH_NAME) }}
           retention-days: 21
           path: ${{ env.VARDIR }}/artifacts
 
diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml
index b3af72d21e..e25dc3f462 100644
--- a/.github/workflows/osx.yml
+++ b/.github/workflows/osx.yml
@@ -77,6 +77,12 @@ jobs:
         with:
           bot-token: ${{ secrets.VKTEAMS_BOT_TOKEN }}
 
+      - name: Calculate short name for Tarantool branch
+        if: failure()
+        run: >
+          echo "SHORT_BRANCH_NAME=$(basename ${{ matrix.tarantool-branch }})" >>
+          $GITHUB_ENV
+
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         if: failure()
@@ -85,7 +91,7 @@ jobs:
             'osx-{0}-{1}-{2}-{3}',
             matrix.osx-version,
             matrix.machine-arch,
-            matrix.tarantool-branch,
+            env.SHORT_BRANCH_NAME,
             matrix.build-type) }}
           retention-days: 21
           path: ${{ env.VARDIR }}/artifacts
-- 
GitLab