Skip to content

馃 (chore): bump m2c to latest (#2073) #71

馃 (chore): bump m2c to latest (#2073)

馃 (chore): bump m2c to latest (#2073) #71

Workflow file for this run

name: Publish images
on:
push:
branches:
- main
workflow_dispatch:
jobs:
push_to_ghcr:
name: Publish images to GHCR
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- name: backend
context: backend
target: prod
- name: frontend
context: frontend
target: prod
- name: nginx
context: nginx
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Generate image tags
run: |
echo "SHORT_SHA=${GITHUB_SHA::12}" >> $GITHUB_ENV
- name: Build and push ${{ matrix.name }}
uses: docker/build-push-action@v7
with:
context: ./${{ matrix.context }}
target: ${{ matrix.target }}
push: true
pull: true
build-args: |
GIT_HASH=${{ env.SHORT_SHA }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/decompme-${{ matrix.name }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/decompme-${{ matrix.name }}:buildcache,mode=max
tags: |
ghcr.io/${{ github.repository_owner }}/decompme-${{ matrix.name }}:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/decompme-${{ matrix.name }}:${{ env.SHORT_SHA }}
ghcr.io/${{ github.repository_owner }}/decompme-${{ matrix.name }}:latest