Skip to content

fixing tags github action #11

fixing tags github action

fixing tags github action #11

name: Create and publish a Docker image
on:
push:
branches: ['develop', 'master']
tags: |

Check failure on line 6 in .github/workflows/push_docker_image.yml

View workflow run for this annotation

GitHub Actions / Create and publish a Docker image

Invalid workflow file

The workflow is not valid. .github/workflows/push_docker_image.yml (Line: 6, Col: 11): Unrecognized named-value: 'github'. Located at position 1 within expression: github.ref == format('refs/heads/{0}', 'develop') .github/workflows/push_docker_image.yml (Line: 11, Col: 11): Unrecognized named-value: 'github'. Located at position 1 within expression: github.ref == format('refs/heads/{0}', 'develop')
# set latest tag for default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }}
pull_request:
branches: ['develop', 'master']
tags: |
# set latest tag for default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }}
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
if: github.ref_type == 'tag'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
if: github.ref_type == 'tag'
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
# Indicates that the Docker build context is the current directory.
# Otherwise, it would be a Git URL (doing a separate clean checkout).
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}x