1
0
mirror of https://github.com/tomav/docker-mailserver.git synced 2024-06-30 13:11:15 +02:00
docker-mailserver/.github/workflows/default_on_push.yml
dependabot[bot] 8842ba7421
chore(deps): bump actions/cache from 2.1.5 to 2.1.6 (#2020)
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.5...v2.1.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
2021-05-31 12:31:40 +02:00

113 lines
3.3 KiB
YAML

name: "Build, Test & Deploy"
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'target/**'
- '.dockerignore'
- '.gitmodules'
- 'Dockerfile'
- 'setup.sh'
tags:
- '*.*.*'
jobs:
build-and-test-image:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.3.0
id: buildx
- name: Cache Docker layers
uses: actions/cache@v2.1.6
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build image locally
uses: docker/build-push-action@v2.4.0
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
build-args: |
VCS_REF=${{ github.sha }}
VCS_VER=${{ github.ref }}
platforms: linux/amd64
load: true
tags: mailserver-testing:ci
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Run test suite
run: >
NAME=mailserver-testing:ci
bash -c 'make generate-accounts tests'
env:
CI: true
build-multiarch-and-publish:
needs: build-and-test-image
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
submodules: recursive
- name: Prepare tags
id: prep
uses: docker/metadata-action@v3.2.0
with:
images: |
${{ secrets.DOCKER_REPOSITORY }}
${{ secrets.GHCR_REPOSITORY }}
tags: |
type=edge,branch=master
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
flavor: |
latest=auto
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.3.0
id: buildx
- name: Cache Docker layers
uses: actions/cache@v2.1.6
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1.9.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1.9.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images locally
uses: docker/build-push-action@v2.4.0
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
build-args: |
VCS_REF=${{ github.sha }}
VCS_VER=${{ github.ref }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache