Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ,
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file (.env.dist) is an example template for the environment variables required by the application.
# The .env file is not versioned in the repository and should be created by duplicating this file.
# To use it, copy this file as .env and define the appropriate values.
# The environment variables defined in .env will be automatically loaded by Docker Compose.

APP_ENV=prod
APP_DEBUG=0
APP_SECRET=CHANGE_THIS_TO_A_SECRET
APP_PORT=8080
APP_ONLINE_MODE=1
XDEBUG_MODE=off # You can enable it by changing to "debug"
XDEBUG_CONFIG="client_host=host.docker.internal"

EXELEARNING_WEB_SOURCECODE_PATH=
EXELEARNING_WEB_CONTAINER_TAG=latest

# Test user data
TEST_USER_EMAIL=user@exelearning.net
TEST_USER_USERNAME=user
TEST_USER_PASSWORD=1234

20 changes: 20 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.git
.github
.gitignore
.aider*
.DS_Store
.distignore
.env
exelearning/
vendor/
node_modules/
phpmd-rules.xml
phpmd.xml
Makefile
docker-compose.yml
Dockerfile
composer.json
composer.lock
composer.phar
CLAUDE.md
*.zip
24 changes: 24 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file (.env.dist) is an example template for the environment variables required by the application.
# The .env file is not versioned in the repository and should be created by duplicating this file.
# To use it, copy this file as .env and define the appropriate values.
# The environment variables defined in .env will be automatically loaded by Docker Compose.

APP_ENV=prod
APP_DEBUG=0
APP_SECRET=CHANGE_THIS_TO_A_SECRET
APP_PORT=8080
APP_ONLINE_MODE=1
XDEBUG_MODE=off # You can enable it by changing to "debug"
XDEBUG_CONFIG="client_host=host.docker.internal"

EXELEARNING_WEB_SOURCECODE_PATH=
EXELEARNING_WEB_CONTAINER_TAG=latest
EXELEARNING_EDITOR_REPO_URL=https://github.com/exelearning/exelearning.git
EXELEARNING_EDITOR_DEFAULT_BRANCH=main
EXELEARNING_EDITOR_REF=
EXELEARNING_EDITOR_REF_TYPE=auto

# Test user data
TEST_USER_EMAIL=user@exelearning.net
TEST_USER_USERNAME=user
TEST_USER_PASSWORD=1234
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: Release

on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: "Release label for package name (e.g. 1.2.3 or 1.2.3-beta)"
required: false
default: ""
editor_repo_url:
description: "Editor source repository URL"
required: false
default: "https://github.com/exelearning/exelearning.git"
editor_ref:
description: "Editor ref value (main, branch name, or tag)"
required: false
default: "main"
editor_ref_type:
description: "Type of editor ref"
required: false
default: "auto"
type: choice
options:
- auto
- branch
- tag

permissions:
contents: write

jobs:
build_and_upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Set environment variables
run: |
if [ "${{ github.event_name }}" = "release" ]; then
RAW_TAG="${GITHUB_REF##*/}"
VERSION_TAG="${RAW_TAG#v}"
echo "RELEASE_TAG=${VERSION_TAG}" >> $GITHUB_ENV
echo "EXELEARNING_EDITOR_REPO_URL=https://github.com/exelearning/exelearning.git" >> $GITHUB_ENV
echo "EXELEARNING_EDITOR_REF=main" >> $GITHUB_ENV
echo "EXELEARNING_EDITOR_REF_TYPE=branch" >> $GITHUB_ENV
else
INPUT_RELEASE="${{ github.event.inputs.release_tag }}"
if [ -z "$INPUT_RELEASE" ]; then
INPUT_RELEASE="manual-$(date +%Y%m%d)-${GITHUB_SHA::7}"
fi
echo "RELEASE_TAG=${INPUT_RELEASE}" >> $GITHUB_ENV
echo "EXELEARNING_EDITOR_REPO_URL=${{ github.event.inputs.editor_repo_url }}" >> $GITHUB_ENV
echo "EXELEARNING_EDITOR_REF=${{ github.event.inputs.editor_ref }}" >> $GITHUB_ENV
echo "EXELEARNING_EDITOR_REF_TYPE=${{ github.event.inputs.editor_ref_type }}" >> $GITHUB_ENV
fi

- name: Build static editor
run: make build-editor

- name: Create package
run: make package RELEASE=${RELEASE_TAG}

- name: Upload ZIP as workflow artifact
uses: actions/upload-artifact@v4
with:
name: mod_exescorm-${{ env.RELEASE_TAG }}
path: mod_exescorm-${{ env.RELEASE_TAG }}.zip

- name: Upload ZIP to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: mod_exescorm-${{ env.RELEASE_TAG }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.aider*
.env

# mess detector rules
phpmd-rules.xml

# Composer ignores
/vendor/
/composer.lock
/composer.phar

# Built static editor files
dist/static/

# Local editor checkout fetched during build
exelearning/
35 changes: 35 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Development Guide

This document covers the development setup for the eXeLearning SCORM plugin.

> **Important:** Do not install this plugin by cloning the repository directly. The repository does not include the embedded editor, which is built during the release process. Always install from a [release ZIP](https://github.com/exelearning/mod_exescorm/releases).

## Development using Makefile

To facilitate development, a `Makefile` is included to simplify Docker-based workflows.

### Environment Variables

You can configure various settings using the `.env` file. If this file does not exist, it will be automatically generated by copying from `.env.dist`. Key variables to configure:

- `EXELEARNING_WEB_SOURCECODE_PATH`: Define the path to the eXeLearning source code if you want to work with a local version.
- `APP_PORT`: Define the port on which the application will run.
- `APP_SECRET`: Set a secret key for the application.
- `EXELEARNING_EDITOR_REPO_URL`: Repository used to fetch embedded editor source code.
- `EXELEARNING_EDITOR_DEFAULT_BRANCH`: Fallback branch when no specific ref is defined.
- `EXELEARNING_EDITOR_REF`: Specific branch or tag to build from (if empty, fallback to default branch).
- `EXELEARNING_EDITOR_REF_TYPE`: `auto`, `branch`, or `tag` to resolve `EXELEARNING_EDITOR_REF`.

## Embedded Editor Source Strategy

The embedded static editor is no longer tied to a git submodule. During `make build-editor` the source is fetched as a shallow checkout from `EXELEARNING_EDITOR_REPO_URL` using:

- `EXELEARNING_EDITOR_REF_TYPE=branch` to force branch mode.
- `EXELEARNING_EDITOR_REF_TYPE=tag` to force tag mode.
- `EXELEARNING_EDITOR_REF_TYPE=auto` to try tag first, then branch.

This keeps the plugin repo lighter and lets CI/manual builds choose `main`, a specific tag, or a feature branch without submodule maintenance.

## Manual Plugin Build in GitHub Actions

The `Release` workflow now supports manual execution (`workflow_dispatch`) from the `main` branch. It accepts editor source parameters (`editor_repo_url`, `editor_ref`, `editor_ref_type`) and a `release_tag` for the generated ZIP name.
Loading