"git@developer.sourcefind.cn:tsoc/superbenchmark.git" did not exist on "93e9d262a0403f581237310588f14433bbdf24ff"
Unverified Commit 53e972c3 authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

CI/CD - Fix bug in build image for push event (#205)

Fix bug in build image for push event.

**Major Revision**
- Fix bug in build image for push event when `github.base_ref` is not set.

**Minor Revision**
- Unify `[` and `[[` usage.
parent e80447f7
......@@ -47,25 +47,25 @@ jobs:
id: metadata
run: |
TAGS=${{ matrix.tags }}
if [ "${{ github.event_name }}" == "push" ] && [[ ${{ github.ref }} == refs/heads/release/* ]]; then
if [[ "${{ github.event_name }}" == "push" ]] && [[ "${{ github.ref }}" == "refs/heads/release/"* ]]; then
TAGS=$(sed "s/main:/release:${GITHUB_REF##*/}-/g" <<< ${TAGS})
fi
if [ "${{ github.event_name }}" == "pull_request" ] && [[ ${{ github.base_ref }} == release/* ]]; then
if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "${{ github.base_ref }}" == "release/"* ]]; then
TAGS=$(sed "s/main:/release:${GITHUB_BASE_REF##*/}-/g" <<< ${TAGS})
fi
if [ "${{ github.event_name }}" == "release" ]; then
if [[ "${{ github.event_name }}" == "release" ]]; then
TAGS=$(sed "s/main:/superbench:${GITHUB_REF##*/}-/g" <<< ${TAGS})
GHCR_TAG=$(cut -d, -f1 <<< ${TAGS} | sed "s#superbench/superbench#ghcr.io/${{ github.repository }}/superbench#g")
TAGS="${TAGS},${GHCR_TAG}"
fi
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
TAGS=$(sed "s/main:/dev:/g" <<< ${TAGS})
fi
DOCKERFILE=dockerfile/${{ matrix.name }}.dockerfile
CACHE_FROM="type=registry,ref=$(cut -d, -f1 <<< ${TAGS})"
CACHE_TO=""
if [ "${{ github.event_name }}" != "pull_request" ]; then
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
CACHE_TO="type=inline,mode=max"
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment