- Add fallback registry to prevent invalid tag format - Make Docker login conditional on secrets being present - Make push conditional on registry being configured - Rename Docker image from calendar to runway 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
1023 B
YAML
35 lines
1023 B
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Registry
|
|
if: ${{ secrets.DOCKER_REGISTRY && secrets.DOCKER_USERNAME && secrets.DOCKER_PASSWORD }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ secrets.DOCKER_REGISTRY }}
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: ${{ secrets.DOCKER_REGISTRY != '' }}
|
|
tags: |
|
|
${{ secrets.DOCKER_REGISTRY || 'localhost:5000' }}/runway:latest
|
|
${{ secrets.DOCKER_REGISTRY || 'localhost:5000' }}/runway:${{ github.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max |