Skip to content

Update actions/checkout action to v4.2.2 #384

Update actions/checkout action to v4.2.2

Update actions/checkout action to v4.2.2 #384

Workflow file for this run

---
name: Build Docker Images
on: # yamllint disable-line rule:truthy
# Trigger the workflow weekly on Thursday as well as on pushes to the default
# branch that include changes to the services/ directory.
schedule:
- cron: '22 20 * * 4'
push:
branches:
- main
paths:
- '.github/workflows/**'
- 'services/**'
pull_request:
paths:
- '.github/workflows/**'
- 'services/**'
workflow_dispatch:
jobs:
image-build-php:
runs-on: ubuntu-latest
strategy:
matrix:
service:
- php-apache-node
- php-nginx-fpm
php:
- 8.1
- 8.2
- 8.3
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: |
PHP_VERSION=${{ matrix.php }}
file: services/${{ matrix.service }}/Dockerfile
# Only push built images if this is not a pull request.
push: ${{ github.event_name != 'pull_request' }}
tags: chromatichq/${{ matrix.service }}:${{ matrix.php }}
- name: Notify slack on failure
if: ${{ failure() && (github.event_name == 'push' || github.event_name == 'schedule') }}
uses: voxmedia/github-action-slack-notify-build@v1.6.0
with:
channel: devops-alerts
status: FAILED
color: danger
env:
SLACK_BOT_TOKEN: ${{ secrets.GHACTION_SLACK_BOT_TOKEN }}
image-build:
runs-on: ubuntu-latest
strategy:
matrix:
service: [node]
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: services/${{ matrix.service }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: chromatichq/${{ matrix.service }}:latest
- name: Notify slack on failure
if: ${{ failure() && (github.event_name == 'push' || github.event_name == 'schedule') }}
uses: voxmedia/github-action-slack-notify-build@v1.6.0
with:
channel: devops-alerts
status: FAILED
color: danger
env:
SLACK_BOT_TOKEN: ${{ secrets.GHACTION_SLACK_BOT_TOKEN }}