Build Docker Image #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build 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 }} |