Build S3DB #84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build S3DB | |
permissions: | |
contents: read | |
packages: write | |
on: | |
workflow_call: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 14 * * 2" # 2pm Patch Tuesday | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
s3db-build: | |
name: Build S3DB | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
database: | |
- postgres | |
- mariadb | |
include: | |
- database: postgres | |
version: 16 | |
- database: postgres | |
version: 15 | |
- database: mariadb | |
version: 11 | |
- database: mariadb | |
version: 10 | |
steps: | |
- name: "Setup: PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
env: | |
runner: self-hosted | |
- uses: benzine-framework/action-setup-docker@main | |
with: | |
ghcr_user: matthewbaggett | |
ghcr_token: ${{ secrets.GITHUB_TOKEN }} | |
docker_hub_user: matthewbaggett | |
docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: "Setup: Login to Private Registry" | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.PRIVATE_REGISTRY }} | |
username: ${{ secrets.PRIVATE_REGISTRY_USER }} | |
password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} | |
- name: "Setup: Checkout Source" | |
uses: actions/checkout@v4 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: "Dependencies: Composer Install" | |
working-directory: s3db | |
run: composer install --ignore-platform-reqs | |
- name: "Build: Build & Push Image" | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: ${{ matrix.database }} | |
file: s3db/Dockerfile.${{ matrix.database }} | |
platforms: ${{ !env.ACT && 'linux/amd64,linux/arm64' || 'linux/amd64' }} | |
push: true | |
tags: | | |
ghcr.io/benzine-framework/s3db:${{ matrix.database }}-${{ matrix.version }} | |
benzine/s3db:${{ matrix.database }}-${{ matrix.version }} | |
${{ secrets.PRIVATE_REGISTRY }}/s3db:${{ matrix.database }}-${{ matrix.version }} | |
cache-from: ${{ !env.ACT && 'type=gha' || '' }} | |
cache-to: ${{ !env.ACT && 'type=gha,mode=max' || '' }} | |
build-contexts: | | |
postgres:injected-version=docker-image://ghcr.io/benzine-framework/postgres:${{ matrix.version }}-alpine | |
mariadb:injected-version=docker-image://ghcr.io/benzine-framework/mariadb:${{ matrix.version }} |