Skip to content

Commit

Permalink
Enable gha support
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Apr 2, 2024
1 parent e6fa068 commit 26b151e
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 4 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build images

on:
push:
paths:
- 'Dockerfile'
- '.dockerignore'
- '.github/workflows/main.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name || github.run_id }}
cancel-in-progress: true

env:
IMAGE_REGISTRY_NAMESPACE: alfresco
IMAGE_REPOSITORY: mailhog

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0

- name: Login to quay.io
if: github.actor != 'dependabot[bot]'
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Login to docker.io
if: github.ref_name == 'master'
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- id: vars
name: Compute Docker vars
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "image_labels=" >> $GITHUB_OUTPUT
else
echo "image_labels=quay.expires-after=2w" >> $GITHUB_OUTPUT
fi
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
type=ref,event=branch
labels: |
${{ steps.vars.outputs.image_labels }}
- name: Build and Push to quay.io
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
push: ${{ github.actor != 'dependabot[bot]' }}
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false

- name: Push Image to docker.io
if: github.ref_name == 'master'
env:
SRC_IMAGE: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}
DST_IMAGE: ${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}
run: |
docker buildx imagetools create ${{ env.SRC_IMAGE }} -t ${{ env.DST_IMAGE }}
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

0 comments on commit 26b151e

Please sign in to comment.