Skip to content

Default branch (master or main) gets pushed to master/main tag and not to the default name latest #147

@guysoft

Description

@guysoft

Behaviour

Default branch (master or main) gets pushed to master/main tag and not to the default docker name latest.
I think this should rather be a feature, or there should be some doc on how to do this (perhaps there one I missed, would love it to be linked if possible).

Steps to reproduce this issue

  1. Push the default branch

Expected behaviour

Should also push to latest branch, or there should be a way to define which branch is set as the latest

Actual behaviour

Pushes to master/main

Configuration

Example build:
https://github.com/guysoft/CustomPiOS/blob/devel/.github/workflows/docker-build.yml

name: ci

on:
  push:
    branches:
      - "master"
      - "devel"
      - "docker-github-actions"

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      -
        name: Docker meta tag
        id: docker_meta
        uses: docker/metadata-action@v3.5.0
        with:
          images: guysoft/custompios
          tag-sha: true
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          context: src
          file: src/Dockerfile
          platforms: linux/amd64,linux/arm64,linux/arm/v7
          push: true
          tags: ${{ steps.docker_meta.outputs.tags }}
          labels: ${{ steps.docker_meta.outputs.labels }}
          secrets: |
            GIT_AUTH_TOKEN=${{ secrets.MY_GITHUB_TOKEN }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions