Skip to content

Build and Push HydroServer Docker Image to GHCR #8

Build and Push HydroServer Docker Image to GHCR

Build and Push HydroServer Docker Image to GHCR #8

Workflow file for this run

name: Build and Push HydroServer Docker Image to GHCR
on:
release:
types: [created]
workflow_dispatch:
inputs:
branch:
description: 'Branch to build the Docker image from'
required: false
default: 'main'
tag_name:
description: 'Tag to apply to the Docker image'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.branch || 'main' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name || github.event.inputs.tag_name }}
ghcr.io/${{ github.repository }}:latest