Skip to content

Build and push app to registry #24

Build and push app to registry

Build and push app to registry #24

name: Build and push app to registry
on:
workflow_run:
workflows: [ "Test and coverage" ]
types: [ requested ]
branches: [ "dev", "master", "releases/**" ]
env:
DOCKER_REGISTRY: ghcr.io
permissions:
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set DOCKER_IMAGE env
run: |
echo "DOCKER_IMAGE=$DOCKER_REGISTRY/taskemapp/server" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: Login to container registry
uses: docker/login-action@v3
id: login
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.DOCKER_IMAGE }}:latest
${{ env.DOCKER_IMAGE }}:${{ github.sha }}