Skip to content

add more validation to branch rebase and merge #5068

add more validation to branch rebase and merge

add more validation to branch rebase and merge #5068

---
# yamllint disable rule:truthy rule:line-length
name: Publish development docker image
on:
workflow_dispatch:
inputs:
publish:
type: boolean
description: Publish the image
default: false
required: true
commit:
type: string
description: commit sha or branch name
default: ''
required: false
platforms:
type: string
description: Comma separated platform list to build the image for
default: "linux/amd64,linux/arm64"
tag:
type: string
description: additional image tag
default: ''
required: false
pull_request:
types:
- labeled
- synchronize
jobs:
meta_data:
if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'cd/preview')
runs-on:
group: huge-runners
outputs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
ref: ${{ steps.ref.outputs.ref }}
short_ref: ${{ steps.short_ref.outputs.short_ref }}
steps:
- name: Set GIT ref
run: echo "ref=${{ inputs.commit == '' && (github.event.pull_request.head.sha == '' && github.sha || github.event.pull_request.head.sha) || inputs.commit }} " >> $GITHUB_OUTPUT
id: ref
- name: Set GIT short ref
run: echo "short_ref=$(echo ${{ steps.ref.outputs.ref }} | cut -c1-7)" >> $GITHUB_OUTPUT
id: short_ref
- name: Set docker image meta data
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ vars.HARBOR_HOST }}/${{ github.repository }}
tags: |
type=raw,value=dev-${{ steps.short_ref.outputs.short_ref }}
type=raw,value=${{ inputs.tag }}
labels: |
org.opencontainers.image.source=${{ github.repository }}
org.opencontainers.image.version=dev-${{ steps.short_ref.outputs.short_ref }}
flavor: |
latest=false
publish-docker-image-dispatch:
if: github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/ci-docker-image.yml
needs: meta_data
secrets: inherit
with:
publish: ${{ inputs.publish }}
version: dev-${{ needs.meta_data.outputs.short_ref }}
ref: ${{ needs.meta_data.outputs.ref }}
tags: ${{needs.meta_data.outputs.tags}}
labels: ${{needs.meta_data.outputs.labels}}
platforms: ${{ inputs.platforms }}
publish-docker-image-pr:
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'cd/preview')
uses: ./.github/workflows/ci-docker-image.yml
needs: meta_data
secrets: inherit
with:
publish: true
version: dev-${{ needs.meta_data.outputs.short_ref }}
ref: ${{ needs.meta_data.outputs.ref }}
tags: ${{ needs.meta_data.outputs.tags }}
labels: ${{ needs.meta_data.outputs.labels }}
platforms: "linux/amd64"