docker-network-graph/.github/workflows/docker-build-push.yml
2024-01-13 21:37:07 +05:00

53 lines
No EOL
1.5 KiB
YAML

name: Docker (Build and Push)
# Controls when the workflow will run
on:
push:
tags:
- 'v*.*.*'
# permissions are needed if pushing to ghcr.io
permissions:
packages: write
jobs:
build_push:
name: Build and Push
runs-on: ubuntu-latest
steps:
# Get the repository's code
- uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/muratovas/docker-network-graph
# Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}