Unverified Commit b9864244 authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

CI/CD - Fix image merge in GitHub Action. (#749)

Fix image merge for release event in GitHub Action.
parent 60189dd6
......@@ -220,8 +220,9 @@ jobs:
fi
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}"
GHCR_TAGS=$(sed "s#superbench/superbench#ghcr.io/${{ github.repository }}/superbench#g" <<< ${TAGS})
SOURCES=$(sed "s/main:/superbench:${GITHUB_REF##*/}-/g" <<< ${SOURCES})
GHCR_SOURCES=$(sed "s#superbench/superbench#ghcr.io/${{ github.repository }}/superbench#g" <<< ${SOURCES})
fi
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
TAGS=$(sed "s/main:/dev:/g" <<< ${TAGS})
......@@ -230,6 +231,8 @@ jobs:
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
echo "sources=${SOURCES}" >> "$GITHUB_OUTPUT"
echo "ghcr_tags=${GHCR_TAGS}" >> "$GITHUB_OUTPUT"
echo "ghcr_sources=${GHCR_SOURCES}" >> "$GITHUB_OUTPUT"
- name: Echo image tags
run: echo ${{ steps.metadata.outputs.tags }}
- name: Echo image sourcs
......@@ -251,7 +254,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Merge and push
- name: Merge and push to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
run: |
docker buildx imagetools create \
......@@ -260,6 +263,15 @@ jobs:
--annotation "index:org.opencontainers.image.revision=${{ github.sha }}" \
--tag ${{ steps.metadata.outputs.tags }} \
${{ steps.metadata.outputs.sources }}
- name: Merge and push to GitHub Container Registry
if: ${{ github.event_name == 'release' }}
run: |
docker buildx imagetools create \
--annotation "index:org.opencontainers.image.source=${{ github.event.repository.html_url }}" \
--annotation "index:org.opencontainers.image.created=${{ github.event.repository.pushed_at }}" \
--annotation "index:org.opencontainers.image.revision=${{ github.sha }}" \
--tag ${{ steps.metadata.outputs.ghcr_tags }} \
${{ steps.metadata.outputs.ghcr_sources }}
- name: Inspect image
if: ${{ github.event_name != 'pull_request' }}
run: |
......
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