Skip to content

chore(deps): update actions/checkout action to v5 #11

chore(deps): update actions/checkout action to v5

chore(deps): update actions/checkout action to v5 #11

name: Build Rails Docker Images
on:
push:
branches: [master]
paths:
- "rails/**/Dockerfile"
- ".github/workflows/rails-docker-build.yml"
pull_request:
branches: [master]
paths:
- "rails/**/Dockerfile"
- ".github/workflows/rails-docker-build.yml"
workflow_dispatch:
jobs:
build-rails:
name: Build Rails Images
runs-on: ubuntu-latest
strategy:
matrix:
include:
- rails-version: '6' # Rails 6
is-latest: false
- rails-version: '7' # Rails 7
is-latest: false
- rails-version: '8' # Rails 8
is-latest: true
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: voxxit/rails
tags: |
type=raw,value=${{ matrix.rails-version }}
type=raw,value=latest,enable=${{ matrix.is-latest == true }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./rails/${{ matrix.rails-version }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max