diff --git a/.github/workflows/docker_publish.yaml b/.github/workflows/docker_publish.yaml index a7ab50b0..08a28e57 100644 --- a/.github/workflows/docker_publish.yaml +++ b/.github/workflows/docker_publish.yaml @@ -1,6 +1,8 @@ name: Publish Docker Image on: + push: + branches: [main] workflow_dispatch: inputs: tags: @@ -15,6 +17,9 @@ permissions: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + # On push to main, inputs.tags is empty, so fall back to "latest" so the + # latest tag tracks main. Manual dispatch still honors custom tags. + TAGS_INPUT: ${{ inputs.tags || 'latest' }} jobs: build-image: @@ -46,7 +51,7 @@ jobs: id: prep run: | TAGS="" - IFS=',' read -ra TAG_ARRAY <<< "${{ inputs.tags }}" + IFS=',' read -ra TAG_ARRAY <<< "${TAGS_INPUT}" for t in "${TAG_ARRAY[@]}"; do TAGS="${TAGS}${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${t}-${{ matrix.arch }}," done @@ -84,7 +89,7 @@ jobs: env: SHORT_SHA: ${{ github.sha }} run: | - IFS=',' read -ra TAG_ARRAY <<< "${{ inputs.tags }}" + IFS=',' read -ra TAG_ARRAY <<< "${TAGS_INPUT}" FIRST_TAG="${TAG_ARRAY[0]}" # Create manifest for first tag with SHA tag