Skip to content

Build and Publish Docker Image on Release #4

Build and Publish Docker Image on Release

Build and Publish Docker Image on Release #4

Workflow file for this run

name: Build and Publish Docker Image on Release
on:
release:
types: [created]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Convert repo name to lowercase
id: lowercase
run: echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ env.REPO_NAME }}:latest
ghcr.io/${{ env.REPO_NAME }}:${{ github.event.release.tag_name }}