Skip to content

Add build & push action #84

Add build & push action

Add build & push action #84

Workflow file for this run

name: Build & Publish
permissions:
contents: read
on:
push:
tags:
- '1.5.*'
jobs:
build-and-testvariants:
name: Build image variants and run tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
include:
- variant: 'apache'
test-files: 'apache-postgres'
docker-tag: roundcube/roundcubemail:1.5.x-apache,roundcube/roundcubemail:${{ env.GITHUB_REF_NAME }}-apache

Check failure on line 21 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Build & Publish

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 21, Col: 25): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITHUB_REF_NAME .github/workflows/build.yml (Line: 25, Col: 25): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITHUB_REF_NAME
test-tag: roundcube/roundcubemail:1.5.x-apache
- variant: 'fpm'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:1.5.x-fpm,roundcube/roundcubemail:${{ env.GITHUB_REF_NAME }}-fpm
test-tag: roundcube/roundcubemail:1.5.x-fpm
- variant: 'fpm-alpine'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:1.5.x-fpm-alpine,roundcube/roundcubemail:${{ env.GITHUB_REF_NAME }}-fpm-alpine
test-tag: roundcube/roundcubemail:1.5.x-fpm-alpine
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get docker hub username
id: creds
run: echo '::set-output name=username::${{ secrets.DOCKER_PULL_USERNAME }}'
- name: Login to Docker Hub
if: steps.creds.outputs.username != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_PULL_USERNAME }}
password: ${{ secrets.DOCKER_PUSH_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Build and push image for "${{ matrix.variant }}"
uses: docker/build-push-action@v5
with:
context: ${{ matrix.variant }}
platforms: "linux/arm64,linux/arm/v6,linux/arm/v7,linux/amd64,"
push: true
tags: ${{ matrix.docker-tag }}
- name: Run tests
env:
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.test-tag }}
run: |
set -exu;
for testFile in ${{ join(matrix.test-files, ' ') }};
do
docker-compose -f ./tests/docker-compose.test-${testFile}.yml \
up --exit-code-from=sut --abort-on-container-exit
done