Skip to content

Publish Docker Image to GitHub Package Registry #42

Publish Docker Image to GitHub Package Registry

Publish Docker Image to GitHub Package Registry #42

name: Publish Docker Image to GitHub Package Registry
on:
push:
tags:
- '*'
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}