Skip to content

cleanup states

cleanup states #5

name: Publish Docker image
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.repository }}
on:
workflow_dispatch:
inputs:
tags:
description: "Please provide a git tag value, e.g. v1.0-manually-triggered.1"
required: true
type: string
default: "v1.0-manually-triggered.1"
push:
tags:
- "v*"
jobs:
push_to_docker_hub:
name: build push docker image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Docker Buildkit env
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: "${{ env.IMAGE_NAME }}"
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: "${{ env.BUILD_CONTEXT }}"
target: ${{ env.BUILD_TARGET_STAGE }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha