Skip to content

Fix: fully depleted credit batches incorrectly marked as expired (#772) #331

Fix: fully depleted credit batches incorrectly marked as expired (#772)

Fix: fully depleted credit batches incorrectly marked as expired (#772) #331

name: Build Docker Images
on:
push:
branches:
- main
workflow_dispatch:
inputs:
prerelease:
description: "Generate prerelease build with branch name and snapshot tags"
required: false
default: false
type: boolean
env:
TAG_NAME: latest
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
app: [backend]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)" >> $GITHUB_ENV
- name: Add BRANCH_NAME env property with branch name
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Build and push Docker image (release)
uses: docker/build-push-action@v5
if: ${{ !inputs.prerelease }}
with:
context: .
file: ./apps/${{ matrix.app }}/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/auto-drive-${{ matrix.app }}:${{ env.TAG_NAME }}
ghcr.io/${{ github.repository_owner }}/auto-drive-${{ matrix.app }}:${{ env.SHORT_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
- name: Build and push Docker image (prerelease)
uses: docker/build-push-action@v5
if: ${{ inputs.prerelease }}
with:
context: .
file: ./apps/${{ matrix.app }}/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/auto-drive-${{ matrix.app }}:${{ env.BRANCH_NAME }}
ghcr.io/${{ github.repository_owner }}/auto-drive-${{ matrix.app }}:snapshot-${{ env.SHORT_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64