Skip to content

build-image-push-ghcr #12

build-image-push-ghcr

build-image-push-ghcr #12

Workflow file for this run

on:
workflow_dispatch:
push:
tags:
- "v*"
name: build-image-push-ghcr
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
directory: ['frontend', 'manager', 'node']
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log into ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/${{ matrix.directory }}
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: ./${{ matrix.directory }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}