Skip to content

Build and Publish Docker Images #128

Build and Publish Docker Images

Build and Publish Docker Images #128

Workflow file for this run

name: Build and Publish Docker Images
on:
workflow_dispatch:
schedule:
- cron: "23 0 * * *"
jobs:
buildmatrix:
name: Create Build Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Cache Setup
id: cache
uses: actions/cache@v4
with:
path: .github/matrix.cache/
key: ${{ runner.os }}-matrix-${{ hashFiles('.github/matrix.php') }}
- name: Set up matrix
id: set-matrix
run: |
php .github/matrix.php >> $GITHUB_OUTPUT
build:
needs: buildmatrix
name: Build Docker Image for ${{ matrix.release.type }}
runs-on: ubuntu-latest
if: ${{ needs.buildmatrix.outputs.matrix != '[]' }}
strategy:
matrix: ${{fromJson(needs.buildmatrix.outputs.matrix)}}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: splitbrain
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
tags: |
${{ matrix.release.type == 'master' && ' ' || format('dokuwiki/dokuwiki:{0}', matrix.release.date) }}
dokuwiki/dokuwiki:${{ matrix.release.type }}
${{ matrix.release.type == 'stable' && 'dokuwiki/dokuwiki:latest' || '' }}
build-args: |
DOKUWIKI_VERSION=${{ matrix.release.type == 'master' && 'master' || matrix.release.date }}
workflow-keepalive:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: liskin/gh-workflow-keepalive@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}