adds workflow build for RealmMaster profile

This commit is contained in:
uprightbass360
2026-01-09 18:18:11 -05:00
parent ce76769f79
commit 61137b5510
8 changed files with 1870 additions and 0 deletions

248
.github/workflows/build-and-publish.yml vendored Normal file
View File

@@ -0,0 +1,248 @@
name: Build and Publish
# This workflow builds AzerothCore with configurable module profiles
# and publishes profile-tagged Docker images to Docker Hub for easy deployment.
#
# Default Profile: RealmMaster (32 modules including playerbots, transmog, solo-lfg, eluna, etc.)
# Available Profiles: RealmMaster, suggested-modules, all-modules, playerbots-only, or custom
# Profile Configuration: See config/module-profiles/
# Documentation: See docs/CICD.md
#
# Published Image Tags:
# - authserver-{profile}-latest (e.g., authserver-realmmaster-latest)
# - authserver-{profile}-YYYYMMDD (e.g., authserver-realmmaster-20260109)
# - authserver-latest (generic tag, defaults to RealmMaster)
# - worldserver-{profile}-latest
# - worldserver-{profile}-YYYYMMDD
# - worldserver-latest (generic tag, defaults to RealmMaster)
on:
schedule:
# Run nightly at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
module_profile:
description: 'Module profile to build (e.g., RealmMaster, suggested-modules, all-modules)'
required: false
type: string
default: 'RealmMaster'
force_rebuild:
description: 'Force rebuild even if no changes detected'
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Git
run: |
# Configure git for module repository cloning
git config --global user.name "GitHub Actions Bot"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git --version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare build environment
env:
TERM: xterm
run: |
# Determine which module profile to use
if [ "${{ github.event_name }}" = "schedule" ]; then
MODULE_PROFILE="RealmMaster"
else
MODULE_PROFILE="${{ github.event.inputs.module_profile }}"
MODULE_PROFILE="${MODULE_PROFILE:-RealmMaster}"
fi
echo "📋 Using module profile: ${MODULE_PROFILE}"
echo "🔧 Running setup.sh to generate proper .env file..."
# Use setup.sh to generate .env with proper configuration
# Benefits of this approach:
# - Uses the same setup logic as local builds (consistency)
# - Handles all path variables correctly (no manual sed patching needed)
# - Automatically determines source variant (standard vs playerbots)
# - Applies module profile and dependencies correctly
# - Centralizes configuration logic in one place (setup.sh)
./setup.sh \
--non-interactive \
--module-config "${MODULE_PROFILE}" \
--deployment-type local \
--force
echo "✅ Environment configuration generated successfully"
# Extract values for GitHub environment
PROJECT_NAME=$(grep '^COMPOSE_PROJECT_NAME=' .env | cut -d'=' -f2 | tr -d '\r' | sed 's/[[:space:]]*#.*//' | sed 's/[[:space:]]*$//')
echo "PROJECT_NAME=${PROJECT_NAME}" >> $GITHUB_ENV
# Store profile name for image tagging (lowercase, replace underscores with hyphens)
PROFILE_TAG=$(echo "${MODULE_PROFILE}" | tr '[:upper:]' '[:lower:]' | tr '_' '-')
echo "PROFILE_TAG=${PROFILE_TAG}" >> $GITHUB_ENV
echo "MODULE_PROFILE=${MODULE_PROFILE}" >> $GITHUB_ENV
# Count enabled modules
MODULE_COUNT=$(grep -c '^MODULE_.*=1' .env || echo "0")
echo "MODULE_COUNT=${MODULE_COUNT}" >> $GITHUB_ENV
# Display configuration summary
echo ""
echo "📊 Build Configuration Summary:"
echo " Project: ${PROJECT_NAME}"
echo " Profile: ${MODULE_PROFILE}"
echo " Profile Tag: ${PROFILE_TAG}"
echo " Modules: ${MODULE_COUNT} enabled"
echo ""
echo "Enabled modules (first 10):"
grep '^MODULE_.*=1' .env | head -10 || true
echo ""
# Show key paths for verification
echo "📂 Key Paths:"
grep '^STORAGE_PATH_LOCAL=' .env || echo " STORAGE_PATH_LOCAL not found"
grep '^MODULES_REBUILD_SOURCE_PATH=' .env || echo " MODULES_REBUILD_SOURCE_PATH not found"
grep '^STACK_SOURCE_VARIANT=' .env || echo " STACK_SOURCE_VARIANT not found"
echo ""
# Verify all Docker images are configured
echo "🐳 Docker Images (that we build and push):"
grep -E '^AC_AUTHSERVER_IMAGE_PLAYERBOTS=' .env || echo " AC_AUTHSERVER_IMAGE_PLAYERBOTS not found"
grep -E '^AC_WORLDSERVER_IMAGE_PLAYERBOTS=' .env || echo " AC_WORLDSERVER_IMAGE_PLAYERBOTS not found"
grep -E '^AC_AUTHSERVER_IMAGE_MODULES=' .env || echo " AC_AUTHSERVER_IMAGE_MODULES not found"
grep -E '^AC_WORLDSERVER_IMAGE_MODULES=' .env || echo " AC_WORLDSERVER_IMAGE_MODULES not found"
- name: Cache Go build cache
uses: actions/cache@v4
with:
path: .gocache
key: ${{ runner.os }}-gocache-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gocache-
- name: Cache local storage
uses: actions/cache@v4
with:
path: local-storage/source
key: ${{ runner.os }}-source-${{ github.sha }}
restore-keys: |
${{ runner.os }}-source-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run build
run: |
# The build.sh script will automatically:
# 1. Generate module state from the enabled modules in .env
# 2. Set up the AzerothCore source repository
# 3. Fetch and clone all enabled module repositories from GitHub
# 4. Stage modules to the source directory
# 5. Compile AzerothCore with all modules
# 6. Tag the resulting Docker images
BUILD_ARGS="--yes"
# Add force flag if manually triggered with force_rebuild
if [ "${{ github.event.inputs.force_rebuild }}" = "true" ]; then
BUILD_ARGS="${BUILD_ARGS} --force"
fi
echo "🔨 Starting build process with ${BUILD_ARGS}..."
echo "This will fetch and build all ${MODULE_COUNT} enabled modules from the ${MODULE_PROFILE} profile"
./build.sh ${BUILD_ARGS}
- name: Tag images for Docker Hub
run: |
DATE_TAG=$(date +%Y%m%d)
# Tag authserver images with profile name
docker tag ${PROJECT_NAME}:authserver-modules-latest \
${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-${PROFILE_TAG}-latest
docker tag ${PROJECT_NAME}:authserver-modules-latest \
${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-${PROFILE_TAG}-${DATE_TAG}
# Also tag as generic 'latest' for backward compatibility
docker tag ${PROJECT_NAME}:authserver-modules-latest \
${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-latest
# Tag worldserver images with profile name
docker tag ${PROJECT_NAME}:worldserver-modules-latest \
${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-${PROFILE_TAG}-latest
docker tag ${PROJECT_NAME}:worldserver-modules-latest \
${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-${PROFILE_TAG}-${DATE_TAG}
# Also tag as generic 'latest' for backward compatibility
docker tag ${PROJECT_NAME}:worldserver-modules-latest \
${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-latest
echo "Tagged images with profile '${PROFILE_TAG}' and date '${DATE_TAG}'"
- name: Push images to Docker Hub
run: |
DATE_TAG=$(date +%Y%m%d)
# Push authserver images (all tags)
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-${PROFILE_TAG}-latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-${PROFILE_TAG}-${DATE_TAG}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-latest
# Push worldserver images (all tags)
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-${PROFILE_TAG}-latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-${PROFILE_TAG}-${DATE_TAG}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-latest
echo "✅ Pushed all image tags to Docker Hub"
- name: Build summary
run: |
DATE_TAG=$(date +%Y%m%d)
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Build completed successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Configuration" >> $GITHUB_STEP_SUMMARY
echo "- **Module Profile**: ${MODULE_PROFILE}" >> $GITHUB_STEP_SUMMARY
echo "- **Enabled Modules**: ${MODULE_COUNT}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>View enabled modules</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
grep '^MODULE_.*=1' .env | sed 's/=1//' || true >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published Images" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "#### Profile-Specific Tags" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-${PROFILE_TAG}-latest\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-${PROFILE_TAG}-${DATE_TAG}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-${PROFILE_TAG}-latest\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-${PROFILE_TAG}-${DATE_TAG}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "#### Generic Tags (backward compatibility)" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:authserver-latest\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/${PROJECT_NAME}:worldserver-latest\`" >> $GITHUB_STEP_SUMMARY

246
.github/workflows/create-release.yml vendored Normal file
View File

@@ -0,0 +1,246 @@
name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
type: string
profile:
description: 'Module profile for this release'
required: false
type: string
default: 'RealmMaster'
prerelease:
description: 'Mark as pre-release'
required: false
type: boolean
default: false
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare release variables
run: |
VERSION="${{ github.event.inputs.version }}"
PROFILE="${{ github.event.inputs.profile }}"
PROFILE_TAG=$(echo "${PROFILE}" | tr '[:upper:]' '[:lower:]' | tr '_' '-')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "PROFILE=${PROFILE}" >> $GITHUB_ENV
echo "PROFILE_TAG=${PROFILE_TAG}" >> $GITHUB_ENV
# Get build date from Docker Hub image (or use current date)
BUILD_DATE=$(date +%Y%m%d)
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_ENV
# Get AzerothCore commit from local-storage if available
if [ -d "local-storage/source/azerothcore-playerbots" ]; then
ACORE_COMMIT=$(cd local-storage/source/azerothcore-playerbots && git rev-parse --short HEAD)
else
ACORE_COMMIT="unknown"
fi
echo "ACORE_COMMIT=${ACORE_COMMIT}" >> $GITHUB_ENV
- name: Read module list from profile
run: |
PROFILE_FILE="config/module-profiles/${PROFILE}.json"
if [ ! -f "$PROFILE_FILE" ]; then
echo "ERROR: Profile file not found: $PROFILE_FILE"
exit 1
fi
# Extract module count
MODULE_COUNT=$(python3 -c "import json; data=json.load(open('$PROFILE_FILE')); print(len(data.get('modules', [])))")
echo "MODULE_COUNT=${MODULE_COUNT}" >> $GITHUB_ENV
# Extract modules for release notes
python3 -c "import json; data=json.load(open('$PROFILE_FILE')); print('\n'.join(['- ' + m for m in data.get('modules', [])]))" > modules.txt
- name: Create deployment package
run: |
PACKAGE_NAME="azerothcore-realmmaster-${VERSION}-${PROFILE_TAG}"
mkdir -p "${PACKAGE_NAME}"
# Copy essential deployment files
cp .env.prebuilt "${PACKAGE_NAME}/.env.prebuilt"
cp docker-compose.yml "${PACKAGE_NAME}/docker-compose.yml"
cp deploy.sh "${PACKAGE_NAME}/deploy.sh"
cp status.sh "${PACKAGE_NAME}/status.sh"
cp cleanup.sh "${PACKAGE_NAME}/cleanup.sh"
cp README.md "${PACKAGE_NAME}/README.md"
# Copy scripts directory
cp -r scripts "${PACKAGE_NAME}/scripts"
# Copy config directory
cp -r config "${PACKAGE_NAME}/config"
# Copy docs directory
cp -r docs "${PACKAGE_NAME}/docs"
# Create a quick start guide specific to this release
cat > "${PACKAGE_NAME}/QUICKSTART.md" <<EOF
# Quick Start - AzerothCore RealmMaster ${VERSION}
## Module Profile: ${PROFILE}
**${MODULE_COUNT} modules included**
## Docker Images
This release uses the following pre-built images:
- \`\${DOCKERHUB_USERNAME}/azerothcore-realmmaster:authserver-${PROFILE_TAG}-${BUILD_DATE}\`
- \`\${DOCKERHUB_USERNAME}/azerothcore-realmmaster:worldserver-${PROFILE_TAG}-${BUILD_DATE}\`
Or use the latest tags:
- \`\${DOCKERHUB_USERNAME}/azerothcore-realmmaster:authserver-${PROFILE_TAG}-latest\`
- \`\${DOCKERHUB_USERNAME}/azerothcore-realmmaster:worldserver-${PROFILE_TAG}-latest\`
## Installation
1. **Edit .env.prebuilt**:
\`\`\`bash
nano .env.prebuilt
# Set: DOCKERHUB_USERNAME=uprightbass360
\`\`\`
2. **Rename to .env**:
\`\`\`bash
mv .env.prebuilt .env
\`\`\`
3. **Deploy**:
\`\`\`bash
chmod +x deploy.sh status.sh cleanup.sh
./deploy.sh
\`\`\`
4. **Check status**:
\`\`\`bash
./status.sh
\`\`\`
## Documentation
- [Pre-Built Images Guide](docs/PREBUILT_IMAGES.md)
- [Getting Started](docs/GETTING_STARTED.md)
- [Troubleshooting](docs/TROUBLESHOOTING.md)
## Support
- GitHub Issues: https://github.com/uprightbass360/AzerothCore-RealmMaster/issues
- AzerothCore Discord: https://discord.gg/gkt4y2x
EOF
# Make scripts executable
chmod +x "${PACKAGE_NAME}/deploy.sh"
chmod +x "${PACKAGE_NAME}/status.sh"
chmod +x "${PACKAGE_NAME}/cleanup.sh"
# Create zip archive
zip -r "${PACKAGE_NAME}.zip" "${PACKAGE_NAME}"
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
- name: Generate release notes
run: |
cat > release_notes.md <<EOF
# AzerothCore RealmMaster ${VERSION} - ${PROFILE} Profile
## 🎯 Module Profile: ${PROFILE}
**${MODULE_COUNT} modules included**
## 📦 Docker Images
Pull these pre-built images from Docker Hub:
**Date-specific (recommended for production)**:
\`\`\`bash
docker pull \${DOCKERHUB_USERNAME}/azerothcore-realmmaster:authserver-${PROFILE_TAG}-${BUILD_DATE}
docker pull \${DOCKERHUB_USERNAME}/azerothcore-realmmaster:worldserver-${PROFILE_TAG}-${BUILD_DATE}
\`\`\`
**Latest (auto-updated nightly)**:
\`\`\`bash
docker pull \${DOCKERHUB_USERNAME}/azerothcore-realmmaster:authserver-${PROFILE_TAG}-latest
docker pull \${DOCKERHUB_USERNAME}/azerothcore-realmmaster:worldserver-${PROFILE_TAG}-latest
\`\`\`
## 🚀 Quick Start
\`\`\`bash
# Download and extract
wget https://github.com/uprightbass360/AzerothCore-RealmMaster/releases/download/${VERSION}/${PACKAGE_NAME}.zip
unzip ${PACKAGE_NAME}.zip
cd ${PACKAGE_NAME}
# Configure Docker Hub username
nano .env.prebuilt
# Set: DOCKERHUB_USERNAME=uprightbass360
# Deploy
mv .env.prebuilt .env
./deploy.sh
\`\`\`
Full documentation in \`docs/PREBUILT_IMAGES.md\`
## 📋 Included Modules
$(cat modules.txt)
## 📊 Build Information
- **Built**: ${BUILD_DATE}
- **AzerothCore Commit**: ${ACORE_COMMIT}
- **Source Variant**: playerbots (for MODULE_PLAYERBOTS support)
- **Profile**: ${PROFILE}
- **Module Count**: ${MODULE_COUNT}
## 📖 Documentation
Full documentation available in the \`docs/\` directory of the release package:
- [Pre-Built Images Guide](https://github.com/uprightbass360/AzerothCore-RealmMaster/blob/${VERSION}/docs/PREBUILT_IMAGES.md)
- [Getting Started Guide](https://github.com/uprightbass360/AzerothCore-RealmMaster/blob/${VERSION}/docs/GETTING_STARTED.md)
- [Module Catalog](https://github.com/uprightbass360/AzerothCore-RealmMaster/blob/${VERSION}/docs/MODULES.md)
- [Troubleshooting](https://github.com/uprightbass360/AzerothCore-RealmMaster/blob/${VERSION}/docs/TROUBLESHOOTING.md)
## 🐛 Known Issues
None at this time. Report issues at: https://github.com/uprightbass360/AzerothCore-RealmMaster/issues
## 💬 Support
- **GitHub Issues**: https://github.com/uprightbass360/AzerothCore-RealmMaster/issues
- **AzerothCore Discord**: https://discord.gg/gkt4y2x
- **Documentation**: https://github.com/uprightbass360/AzerothCore-RealmMaster/tree/${VERSION}/docs
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
name: "RealmMaster ${{ env.VERSION }} - ${{ env.PROFILE }} Profile"
body_path: release_notes.md
files: |
${{ env.PACKAGE_NAME }}.zip
prerelease: ${{ github.event.inputs.prerelease }}
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release summary
run: |
echo "## Release Created Successfully! 🎉" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version**: ${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "**Profile**: ${{ env.PROFILE }}" >> $GITHUB_STEP_SUMMARY
echo "**Modules**: ${{ env.MODULE_COUNT }}" >> $GITHUB_STEP_SUMMARY
echo "**Package**: ${{ env.PACKAGE_NAME }}.zip" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📦 Release available at:" >> $GITHUB_STEP_SUMMARY
echo "https://github.com/${{ github.repository }}/releases/tag/${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY