Skip to content

Commit 98c8eb8

Browse files
fix(ci): fix push bug.
Signed-off-by: Electronic-Waste <[email protected]>
1 parent 02d446e commit 98c8eb8

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.github/workflows/build-and-push-images.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,29 @@ jobs:
3232
- name: Set Push Flag
3333
id: set-push
3434
run: |
35-
if [[ "${{ github.event_name }}" == "push" && (${{ github.ref == 'refs/heads/main' }} || ${{ startsWith(github.ref, 'refs/tags/') }})]]; then
36-
echo "push=true" >> $GITHUB_OUTPUT
37-
else
38-
echo "push=false" >> $GITHUB_OUTPUT
39-
fi
35+
echo "push=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}" >> $GITHUB_OUTPUT
4036
41-
- name: Build And Publish Component ${{ matrix.component-name }}
37+
- name: Publish Component ${{ matrix.component-name }}
38+
if: >-
39+
github.repository == 'databendcloud/databend-operator' &&
40+
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
41+
id: publish
4242
uses: ./.github/workflows/template-publish-image
4343
with:
4444
image: ${{ matrix.component-name }}
4545
dockerfile: ${{ matrix.dockerfile }}
4646
platforms: ${{ matrix.platforms }}
4747
context: ${{ matrix.context || '.' }}
48-
push: ${{ steps.set-push.outputs.push }}
48+
push: true
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Test Build for Component ${{ matrix.component-name }}
52+
if: steps.publish.outcome == 'skipped'
53+
uses: ./.github/workflows/template-publish-image
54+
with:
55+
image: ${{ matrix.component-name }}
56+
dockerfile: ${{ matrix.dockerfile }}
57+
platforms: ${{ matrix.platforms }}
58+
context: ${{ matrix.context || '.' }}
59+
push: false
4960
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/template-publish-image/action.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ runs:
125125
126126
echo "args=${BUILD_ARGS}" >> $GITHUB_OUTPUT
127127
echo "Prepared build args: ${BUILD_ARGS}"
128+
echo "Will push? ${{ inputs.push }}"
128129
129130
- name: Add Docker Tags
130131
id: meta
@@ -141,7 +142,7 @@ runs:
141142
platforms: ${{ inputs.platforms }}
142143
context: ${{ inputs.context }}
143144
file: ${{ inputs.dockerfile }}
144-
push: ${{ inputs.push == 'true' }}
145+
push: false
145146
tags: ${{ steps.meta.outputs.tags }}
146147
cache-from: type=gha,scope=${{ inputs.image }}-${{ github.workflow }}
147148
cache-to: type=gha,mode=max,scope=${{ inputs.image }}-${{ github.workflow }},ignore-error=true

0 commit comments

Comments
 (0)