phanpy-docker/.github/workflows/build-and-publish.yaml
2024-04-16 18:20:25 +02:00

46 lines
1.3 KiB
YAML

name: Publish Docker image
on:
workflow_dispatch:
inputs:
phanpy_version:
description: Target Phanpy version
required: true
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_push_to_registry:
name: "Build and Push to Registry: phanpy ${{ inputs.phanpy_version }}"
runs-on: ubuntu-latest
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
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
${{ inputs.phanpy_version }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
VERSION=${{ inputs.phanpy_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}