Skip to content

refactor: implement advanced state management and sync #1

refactor: implement advanced state management and sync

refactor: implement advanced state management and sync #1

Workflow file for this run

name: Publish Moodle Image
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
MOODLE_VERSION: 5.1.3
MOODLE_MAJOR: 501
PHP_LTS: 8.2
PHP_LATEST: 8.4
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php_version: ['8.2', '8.3', '8.4']
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# Primary versioned tag (e.g., 501-php8.4)
type=raw,value=${{ env.MOODLE_MAJOR }}-php${{ matrix.php_version }}
# Major version tag (e.g., 501) points to LTS PHP (8.2)
type=raw,value=${{ env.MOODLE_MAJOR }},enable=${{ matrix.php_version == env.PHP_LTS }}
# 'lts' tag points to latest major (501) and LTS PHP (8.2)
type=raw,value=lts,enable=${{ matrix.php_version == env.PHP_LTS }}
# 'latest' tag points to latest major (501) and latest PHP (8.4)
type=raw,value=latest,enable=${{ matrix.php_version == env.PHP_LATEST }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
PHP_VERSION=${{ matrix.php_version }}
MOODLE_VERSION=${{ env.MOODLE_VERSION }}
MOODLE_MAJOR_VERSION=${{ env.MOODLE_MAJOR }}