Add git submodule and Gitea CI/CD pipeline for v0.7.2

- Convert wc-licensed-product-client from Composer VCS to git submodule
- Add Gitea Actions workflow for automated releases on version tags
- Update composer.json to use path repository for submodule
- Workflow includes: submodule checkout, PHP setup, translation compilation,
  version verification, package creation, checksum generation, release upload

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 21:53:06 +01:00
parent ac1814cbb0
commit f32758ab28
7 changed files with 266 additions and 13 deletions

View File

@@ -0,0 +1,162 @@
name: Create Release Package
on:
push:
tags:
- 'v*'
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code with submodules
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, xml, zip, intl, gettext
tools: composer:v2
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Validate composer.json
run: composer validate --strict
- name: Install dependencies
run: composer install --no-dev --optimize-autoloader --prefer-dist
- name: Install gettext for translation compilation
run: sudo apt-get update && sudo apt-get install -y gettext
- name: Compile translations
run: |
for po in languages/*.po; do
if [ -f "$po" ]; then
mo="${po%.po}.mo"
echo "Compiling $po -> $mo"
msgfmt -o "$mo" "$po"
fi
done
- name: Verify version in plugin header
run: |
PLUGIN_VERSION=$(grep -oP 'Version:\s*\K[0-9]+\.[0-9]+\.[0-9]+' wc-licensed-product.php | head -1)
TAG_VERSION=${{ steps.version.outputs.version }}
if [ "$PLUGIN_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch! Plugin header: $PLUGIN_VERSION, Tag: $TAG_VERSION"
exit 1
fi
echo "Version verified: $PLUGIN_VERSION"
- name: Create release directory
run: mkdir -p releases
- name: Build release package
run: |
PLUGIN_NAME="wc-licensed-product"
VERSION=${{ steps.version.outputs.version }}
RELEASE_FILE="releases/${PLUGIN_NAME}-${VERSION}.zip"
# Create zip from parent directory to maintain proper subdirectory structure
cd ..
zip -r "${PLUGIN_NAME}/${RELEASE_FILE}" "${PLUGIN_NAME}" \
-x "${PLUGIN_NAME}/.git/*" \
-x "${PLUGIN_NAME}/.gitea/*" \
-x "${PLUGIN_NAME}/.gitmodules" \
-x "${PLUGIN_NAME}/.gitignore" \
-x "${PLUGIN_NAME}/lib/*" \
-x "${PLUGIN_NAME}/releases/*" \
-x "${PLUGIN_NAME}/vendor/magdev/wc-licensed-product-client/.git" \
-x "${PLUGIN_NAME}/vendor/magdev/wc-licensed-product-client/.git/*" \
-x "${PLUGIN_NAME}/vendor/*/.git/*" \
-x "${PLUGIN_NAME}/tests/*" \
-x "${PLUGIN_NAME}/CLAUDE.md" \
-x "${PLUGIN_NAME}/*.po~" \
-x "${PLUGIN_NAME}/wp-core" \
-x "${PLUGIN_NAME}/wp-plugins" \
-x "${PLUGIN_NAME}/composer.lock"
echo "Created release package: ${RELEASE_FILE}"
- name: Generate SHA256 checksum
run: |
VERSION=${{ steps.version.outputs.version }}
cd releases
sha256sum "wc-licensed-product-${VERSION}.zip" > "wc-licensed-product-${VERSION}.zip.sha256"
cat "wc-licensed-product-${VERSION}.zip.sha256"
- name: Verify package structure
run: |
VERSION=${{ steps.version.outputs.version }}
echo "=== Package contents ==="
unzip -l "releases/wc-licensed-product-${VERSION}.zip" | head -50
echo ""
echo "=== Verification checks ==="
# Check main plugin file exists
if unzip -l "releases/wc-licensed-product-${VERSION}.zip" | grep -q "wc-licensed-product/wc-licensed-product.php"; then
echo "Main plugin file: OK"
else
echo "ERROR: Main plugin file not found!"
exit 1
fi
# Check vendor directory exists
if unzip -l "releases/wc-licensed-product-${VERSION}.zip" | grep -q "wc-licensed-product/vendor/"; then
echo "Vendor directory: OK"
else
echo "ERROR: Vendor directory not found!"
exit 1
fi
# Check lib directory is excluded
if unzip -l "releases/wc-licensed-product-${VERSION}.zip" | grep -q "wc-licensed-product/lib/"; then
echo "ERROR: lib/ directory should be excluded!"
exit 1
else
echo "lib/ excluded: OK"
fi
# Check .git directories are excluded
if unzip -l "releases/wc-licensed-product-${VERSION}.zip" | grep -q "\.git"; then
echo "WARNING: .git files found in package"
else
echo ".git excluded: OK"
fi
- name: Extract changelog for release
id: changelog
run: |
VERSION=${{ steps.version.outputs.version }}
# Extract changelog section for this version
CHANGELOG=$(awk "/^## \[?${VERSION}\]?/,/^## \[?[0-9]+\.[0-9]+\.[0-9]+\]?/" CHANGELOG.md | head -n -1)
if [ -z "$CHANGELOG" ]; then
CHANGELOG="Release v${VERSION}"
fi
# Escape for GitHub Actions
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Gitea Release
uses: actions/gitea-release-action@v1
with:
token: ${{ secrets.SRC_GITEA_TOKEN }}
tag: ${{ github.ref_name }}
title: "v${{ steps.version.outputs.version }}"
body: ${{ steps.changelog.outputs.changelog }}
prerelease: ${{ contains(github.ref_name, '-') }}
files: |
releases/wc-licensed-product-${{ steps.version.outputs.version }}.zip
releases/wc-licensed-product-${{ steps.version.outputs.version }}.zip.sha256

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "lib/wc-licensed-product-client"]
path = lib/wc-licensed-product-client
url = https://src.bundespruefstelle.ch/magdev/wc-licensed-product-client.git

View File

@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.7.2] - 2026-01-29
### Added
- **Gitea CI/CD Pipeline**: Automated release workflow triggered on version tags
- Automatic package creation with proper WordPress subdirectory structure
- SHA256 checksum generation for package integrity
- Changelog extraction for release notes
- Pre-release detection for hyphenated tags (e.g., `v0.7.2-rc1`)
### Changed
- **Git Submodule Migration**: `magdev/wc-licensed-product-client` is now a git submodule
- Located at `lib/wc-licensed-product-client` instead of being fetched via Composer VCS
- Composer now uses `path` type repository pointing to local submodule
- Improves version control clarity and development workflow
- Symlinked to `vendor/` during `composer install`
### Developer Notes
- New file: `.gitea/workflows/release.yml` for CI/CD automation
- Updated `composer.json`: Repository type changed from `vcs` to `path`
- Created `.gitmodules` for submodule tracking
- Release packages now exclude `lib/` directory (vendor has installed copy)
- Submodule checkout required: `git submodule update --init --recursive`
## [0.7.1] - 2026-01-28
### Fixed

View File

@@ -32,9 +32,7 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w
**Note for AI Assistants:** Clean this section after the specific features are done or new releases are made. Effective changes are tracked in `CHANGELOG.md`. Do not add completed versions here - document them in the Session History section at the end of this file.
### Version 0.7.2
No pending features.
No pending roadmap items.
## Technical Stack
@@ -1878,3 +1876,65 @@ Bug fix release ensuring compatibility with updated `magdev/wc-licensed-product-
- Created release package: `releases/wc-licensed-product-0.7.1.zip` (886 KB)
- SHA256: `6ffd0bdf47395436bbc28a029eff4c6d065f2b5b64c687b96ae36a74c3ee34ef`
- Tagged as `v0.7.1` and pushed to `main` branch
### 2026-01-29 - Version 0.7.2 - Git Submodule & CI/CD Pipeline
**Overview:**
Infrastructure release converting the client library dependency to a git submodule and implementing automated CI/CD releases via Gitea Actions.
**Git Submodule Migration:**
- Converted `magdev/wc-licensed-product-client` from Composer VCS dependency to git submodule
- Submodule located at `lib/wc-licensed-product-client`
- Composer uses `path` type repository pointing to local submodule
- Symlinked to `vendor/magdev/wc-licensed-product-client` during `composer install`
**Gitea CI/CD Pipeline:**
- New workflow at `.gitea/workflows/release.yml`
- Triggers on version tags (`v*`)
- Automated steps:
- Checkout with recursive submodules
- PHP 8.3 setup with required extensions
- Composer dependency installation (production only)
- Translation compilation (`.po` to `.mo`)
- Version verification against plugin header
- Release package creation with proper exclusions
- SHA256 checksum generation
- Package structure verification
- Changelog extraction for release notes
- Gitea release creation with asset upload
- Pre-release detection for hyphenated tags
**New files:**
- `.gitea/workflows/release.yml` - Gitea Actions workflow for automated releases
- `.gitmodules` - Git submodule configuration (created by git)
**Modified files:**
- `composer.json` - Changed repository type from `vcs` to `path`, URL to `lib/wc-licensed-product-client`
- `CHANGELOG.md` - Added v0.7.2 release notes
- `CLAUDE.md` - Removed v0.7.2 from roadmap, added session history
**Package Exclusions:**
Release packages exclude: `.git/`, `.gitea/`, `.gitmodules`, `lib/` (submodule source), `vendor/**/.git`, `tests/`, `CLAUDE.md`, `*.po~`, `wp-core`, `wp-plugins`, `composer.lock`
**Developer Workflow Changes:**
After cloning the repository, developers must now run:
```bash
git submodule update --init --recursive
composer install
```
**Technical notes:**
- Path repository uses `@dev` version constraint for development branch compatibility
- Composer creates symlink from `vendor/magdev/wc-licensed-product-client` to `../../lib/wc-licensed-product-client`
- CI uses `actions/checkout@v4` with `submodules: recursive` for proper submodule initialization
- Release workflow uses `actions/gitea-release-action@v1` for Gitea-native release creation
- Requires `RELEASE_TOKEN` secret configured in Gitea repository settings

View File

@@ -12,14 +12,14 @@
],
"repositories": [
{
"type": "vcs",
"url": "https://src.bundespruefstelle.ch/magdev/wc-licensed-product-client.git"
"type": "path",
"url": "lib/wc-licensed-product-client"
}
],
"require": {
"php": ">=8.3.0",
"twig/twig": "^3.0",
"magdev/wc-licensed-product-client": "dev-main"
"magdev/wc-licensed-product-client": "@dev"
},
"autoload": {
"psr-4": {

15
composer.lock generated
View File

@@ -4,15 +4,15 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "05af8ab515abe7e689c610724b54e27a",
"content-hash": "f13b7ed9531068d0180f28adc8a80397",
"packages": [
{
"name": "magdev/wc-licensed-product-client",
"version": "dev-main",
"source": {
"type": "git",
"url": "https://src.bundespruefstelle.ch/magdev/wc-licensed-product-client.git",
"reference": "56abe8a97c72419c07a6daf263ba6f4a9b5fe4b1"
"dist": {
"type": "path",
"url": "lib/wc-licensed-product-client",
"reference": "f9281ec5fb23bf1993ab0240e0347c835009a10f"
},
"require": {
"php": "^8.3",
@@ -24,7 +24,6 @@
"require-dev": {
"phpunit/phpunit": "^11.0"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
@@ -52,7 +51,9 @@
"issues": "https://src.bundespruefstelle.ch/magdev/wc-licensed-product-client/issues",
"source": "https://src.bundespruefstelle.ch/magdev/wc-licensed-product-client"
},
"time": "2026-01-28T10:56:47+00:00"
"transport-options": {
"relative": true
}
},
{
"name": "psr/cache",