Skip to content

Commit 8df4b4b

Browse files
committed
optim
1 parent fa932c4 commit 8df4b4b

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/ci_release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,23 @@ jobs:
3535
id: set-tag
3636
run: |
3737
if [ -n "${{ github.event.pull_request.number }}" ]; then
38-
echo "tag=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
38+
TAG="pr-${{ github.event.pull_request.number }}"
39+
echo "::notice::Using PR-based tag: $TAG"
3940
else
40-
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
41+
# Sanitize ref_name by replacing / with -
42+
TAG="${{ github.ref_name }}"
43+
TAG="${TAG//\//-}"
44+
echo "::notice::Using branch/tag-based tag: $TAG"
4145
fi
4246
47+
# Validate tag format
48+
if [[ ! "$TAG" =~ ^[a-zA-Z0-9._-]+$ ]]; then
49+
echo "::error::Invalid image tag format: $TAG"
50+
exit 1
51+
fi
52+
53+
echo "tag=$TAG" >> $GITHUB_OUTPUT
54+
4355
lint:
4456
permissions:
4557
contents: read
@@ -65,7 +77,7 @@ jobs:
6577
image-tag: ${{ needs.determine-image-tag.outputs.tag }}
6678

6779
docker-tests:
68-
needs: [determine-image-tag, docker]
80+
needs: [docker]
6981
uses: ./.github/workflows/docker-tests.yml
7082
secrets: inherit
7183
permissions:
@@ -93,7 +105,7 @@ jobs:
93105
94106
# Make a release if this is a manually trigger job, i.e. workflow_dispatch
95107
release:
96-
needs: [lint, docker, test, docker-tests, proto, branch_name]
108+
needs: [lint, test, docker-tests, proto, branch_name]
97109
runs-on: ubuntu-latest
98110
if: ${{ github.event_name == 'workflow_dispatch' }}
99111
permissions: "write-all"

0 commit comments

Comments
 (0)