Skip to content

Add deployment workflow #1

Add deployment workflow

Add deployment workflow #1

Workflow file for this run

name: Deploy to GitHub Container Registry
on:
push:
tags: [ '*.*' ]
env:
DOCKER_IMAGE_NAME: "galera_healthcheck"
jobs:
build-and-publish-image:
name: Build and Publish Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
working-directory: ./
run: docker build -t $DOCKER_IMAGE_NAME:latest -t $DOCKER_IMAGE_NAME:$current_version .
- name: Login to GitHub Container Registry
run: echo ${{ secrets.TOKEN }} | docker login ghcr.io -u ${{ secrets.USERNAME }} --password-stdin
- name: Push Docker image to GitHub Container Registry
run: |
current_version=$(echo ${{ github.ref_name }} | sed 's/\([0-9]*\.[0-9]*\).*$/\1/')
docker tag $DOCKER_IMAGE_NAME:latest ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:latest
docker tag $DOCKER_IMAGE_NAME:$current_version ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:$current_version
docker push ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:latest
docker push ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:$current_version