Skip to content

Publish Docker Image #2

Publish Docker Image

Publish Docker Image #2

name: Publish Docker Image
on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Release Version. For example, `1.2.8`'
required: true
default: ''
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate docker image metadata
uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository_owner }}/tars-server
tags: |
type=semver,pattern={{version}},value=v${{ github.event.inputs.version }}
type=semver,pattern={{major}}.{{minor}},value=v${{ github.event.inputs.version }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}