Skip to content
Merged
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
117 changes: 114 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build MudletBootstrap
on:
push:
branches: [master]
branches: [master, development]
tags:
- 'v*' # Add tag trigger for releases
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -164,13 +166,13 @@ jobs:

- name: (Windows) Login to Azure
uses: azure/login@v2
if: runner.os == 'Windows' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request'
if: runner.os == 'Windows' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && github.repository == 'Mudlet/Mudlet'
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Get Azure access token for code signing
shell: pwsh
if: runner.os == 'Windows' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request'
if: runner.os == 'Windows' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && github.repository == 'Mudlet/Mudlet'
run: |
$token = (az account get-access-token --resource https://codesigning.azure.net | ConvertFrom-Json).accessToken
"::add-mask::$token"
Expand Down Expand Up @@ -206,3 +208,112 @@ jobs:
name: ${{env.UPLOAD_FILENAME}}
path: ${{env.FOLDER_TO_UPLOAD}}

release:
if: startsWith(github.ref, 'refs/tags/')
needs: compile
runs-on: ubuntu-latest

steps:
- name: Checkout Source (for GameList.txt)
uses: actions/checkout@v5

- name: Download all platform artifacts
uses: actions/download-artifact@v4
with:
path: ./platform-artifacts

- name: Organize launchers by game
run: |
chmod +x $GITHUB_WORKSPACE/CI/organize-launchers.sh
$GITHUB_WORKSPACE/CI/organize-launchers.sh

- name: Generate release body
run: |
echo "=== Generating release body ==="

# Get repository and tag info
REPO="${{ github.repository }}"
TAG="${{ github.ref_name }}"
BASE_URL="https://github.com/$REPO/releases/download/$TAG"

echo "Base URL: $BASE_URL"

# Start building the release body
cat > release-body.md << 'EOF'
## MudletBootstrap Release ${{ github.ref_name }}

Choose your game below and download the appropriate file for your operating system:

EOF

# Add each game as a section
if [ -d "organized-releases" ]; then
for game_dir in organized-releases/*/; do
if [ -d "$game_dir" ]; then
game_name=$(basename "$game_dir")
echo "### $game_name" >> release-body.md
echo "" >> release-body.md

# Check for each platform
windows_file=$(find "$game_dir" -name "*Windows.exe" | head -1)
macos_file=$(find "$game_dir" -name "*macOS.dmg" | head -1)
linux_file=$(find "$game_dir" -name "*Linux.AppImage.tar" | head -1)

if [ -n "$windows_file" ]; then
filename=$(basename "$windows_file")
echo "- **Windows**: [\`$filename\`]($BASE_URL/$filename)" >> release-body.md
fi

if [ -n "$macos_file" ]; then
filename=$(basename "$macos_file")
echo "- **macOS**: [\`$filename\`]($BASE_URL/$filename)" >> release-body.md
fi

if [ -n "$linux_file" ]; then
filename=$(basename "$linux_file")
echo "- **Linux**: [\`$filename\`]($BASE_URL/$filename)" >> release-body.md
fi

echo "" >> release-body.md
fi
done
fi

# Add installation instructions
cat >> release-body.md << 'EOF'
## Installation Instructions

### Windows
1. Download the `.exe` file for your game
2. Run MudletBootstrap - it'll download & install Mudlet for you
3. You can delete MudletBootstrap after - Mudlet is all set up to play your favourite game.

### macOS
1. Download the `.dmg` file for your game
2. Open the DMG file
3. Runt he MudletBootstrap app from within the mounted DMG

### Linux
1. Download the `.AppImage.tar` file for your game
2. Extract it: `tar -xf MudletBootstrap-[game]-Linux.AppImage.tar`
2. Extract and run the AppImage within: `MudletBootstrap-[game].AppImage`
3. You can delete MudletBootstrap after - Mudlet is all set up to play your favourite
EOF

echo "Generated release body:"
cat release-body.md

- name: Create Release with Game Organization
uses: softprops/action-gh-release@v1
with:
files: organized-releases/**/*
tag_name: ${{ github.ref_name }}
name: MudletBootstrap ${{ github.ref_name }}
body_path: release-body.md
draft: false
prerelease: false
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


23 changes: 23 additions & 0 deletions CI/deploy-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ if [[ ! -d "$uploadDirUnix" ]]; then
mkdir -p "$uploadDirUnix"
fi

# Check if this is a tagged release
IS_RELEASE=false
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
IS_RELEASE=true
echo "=== Building for RELEASE ==="
mkdir -p "${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games"
else
echo "=== Building for regular build ==="
fi

# Set up Java for code signing if Azure token is available
if [ -n "${AZURE_ACCESS_TOKEN}" ]; then
echo "=== Setting up Java 21 for signing ==="
Expand Down Expand Up @@ -102,10 +112,23 @@ while IFS= read -r line || [[ -n "$line" ]]; do
#rsync -avR "${PACKAGE_DIR}"/./* "$uploadDirUnix"
cp -r "${PACKAGE_DIR}/"* "$uploadDirUnix"

# If this is a release, also copy to extracted-games with standardized naming
if [ "$IS_RELEASE" = true ]; then
echo "Creating release version for $gameName"
mkdir -p "${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games/$gameName"
cp "${PACKAGE_DIR}/MudletBootstrap-${gameName}.exe" \
"${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games/$gameName/MudletBootstrap-$gameName-Windows.exe"
fi

cd "$GITHUB_WORKSPACE" || exit 1

done < "${GITHUB_WORKSPACE}/GameList.txt"

if [ "$IS_RELEASE" = true ]; then
echo "=== Release files created ==="
find "${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games" -type f | sort
fi

# Append these variables to the GITHUB_ENV to make them available in subsequent steps
{
echo "FOLDER_TO_UPLOAD=${uploadDir}\\"
Expand Down
87 changes: 87 additions & 0 deletions CI/organize-launchers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

echo "=== Organizing launchers by game ==="

echo "Listing files in ./platform-artifacts"
ls ./platform-artifacts

# Create organized structure
mkdir -p organized-releases

# Look for extracted-games directories in the downloaded artifacts
echo "Searching for extracted-games directories..."
find ./platform-artifacts -name "extracted-games" -type d | while read extracted_dir; do
echo "Found extracted-games directory: $extracted_dir"
if [ -d "$extracted_dir" ]; then
# Copy all game directories from this platform's extracted-games
cp -r "$extracted_dir"/* organized-releases/ 2>/dev/null || true
fi
done

# If no extracted-games directories found, look for game files in the artifact directories directly
if [ ! "$(ls -A organized-releases 2>/dev/null)" ]; then
echo "No extracted-games directories found, looking for game files in artifact directories..."

# Check each platform artifact directory
for platform_dir in ./platform-artifacts/*/; do
if [ -d "$platform_dir" ]; then
platform_name=$(basename "$platform_dir")
echo "Checking platform directory: $platform_name"

# Look for game launcher files
case "$platform_name" in
*MINGW64*|*Windows*)
echo " Looking for Windows executables..."
find "$platform_dir" -name "*.exe" -type f | while read launcher; do
if [ -f "$launcher" ]; then
filename=$(basename "$launcher")
echo " Found Windows launcher: $filename"
# Extract game name (format: MudletBootstrap-GameName.exe)
if [[ "$filename" =~ MudletBootstrap-(.+)\.exe$ ]]; then
gameName="${BASH_REMATCH[1]}"
echo " Game: $gameName"
mkdir -p "organized-releases/$gameName"
cp "$launcher" "organized-releases/$gameName/MudletBootstrap-$gameName-Windows.exe"
fi
fi
done
;;
*macOS*)
echo " Looking for macOS DMG files..."
find "$platform_dir" -name "*.dmg" -type f | while read launcher; do
if [ -f "$launcher" ]; then
filename=$(basename "$launcher")
echo " Found macOS launcher: $filename"
# Extract game name (format: MudletBootstrap-GameName.dmg)
if [[ "$filename" =~ MudletBootstrap-(.+)\.dmg$ ]]; then
gameName="${BASH_REMATCH[1]}"
echo " Game: $gameName"
mkdir -p "organized-releases/$gameName"
cp "$launcher" "organized-releases/$gameName/MudletBootstrap-$gameName-macOS.dmg"
fi
fi
done
;;
*linux*)
echo " Looking for Linux AppImage files..."
find "$platform_dir" -name "*.AppImage.tar" -type f | while read launcher; do
if [ -f "$launcher" ]; then
filename=$(basename "$launcher")
echo " Found Linux launcher: $filename"
# Extract game name (format: MudletBootstrap-linux-x64-GameName.AppImage.tar)
if [[ "$filename" =~ MudletBootstrap-linux-x64-(.+)\.AppImage\.tar$ ]]; then
gameName="${BASH_REMATCH[1]}"
echo " Game: $gameName"
mkdir -p "organized-releases/$gameName"
cp "$launcher" "organized-releases/$gameName/MudletBootstrap-$gameName-Linux.AppImage.tar"
fi
fi
done
;;
esac
fi
done
fi

echo "Final organized structure:"
find organized-releases -type f | sort
23 changes: 23 additions & 0 deletions CI/package-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ fi

mkdir "${GITHUB_WORKSPACE}/upload/"

# Check if this is a tagged release
IS_RELEASE=false
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
IS_RELEASE=true
echo "=== Building for RELEASE ==="
mkdir -p "${GITHUB_WORKSPACE}/extracted-games"
else
echo "=== Building for regular build ==="
fi

echo "Working in directory:"
pwd

Expand Down Expand Up @@ -67,6 +77,14 @@ while IFS= read -r line || [[ -n "$line" ]]; do

mv "MudletBootstrap-linux-x64.AppImage.tar" "${GITHUB_WORKSPACE}/upload/MudletBootstrap-linux-x64-${gameName}.AppImage.tar"

# If this is a release, also copy to extracted-games with standardized naming
if [ "$IS_RELEASE" = true ]; then
echo "Creating release version for $gameName"
mkdir -p "${GITHUB_WORKSPACE}/extracted-games/$gameName"
cp "${GITHUB_WORKSPACE}/upload/MudletBootstrap-linux-x64-${gameName}.AppImage.tar" \
"${GITHUB_WORKSPACE}/extracted-games/$gameName/MudletBootstrap-$gameName-Linux.AppImage.tar"
fi

rm -rf app/
done < "${GITHUB_WORKSPACE}/GameList.txt"

Expand All @@ -75,6 +93,11 @@ echo "=== ... later, via Github ==="

ls ${GITHUB_WORKSPACE}/upload

if [ "$IS_RELEASE" = true ]; then
echo "=== Release files created ==="
find "${GITHUB_WORKSPACE}/extracted-games" -type f | sort
fi

{
echo "FOLDER_TO_UPLOAD=${GITHUB_WORKSPACE}/upload"
echo "UPLOAD_FILENAME=MudletBootstrap-linux-x64"
Expand Down
23 changes: 23 additions & 0 deletions CI/package-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ npm install -g appdmg

mkdir -p "${GITHUB_WORKSPACE}/upload/"

# Check if this is a tagged release
IS_RELEASE=false
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
IS_RELEASE=true
echo "=== Building for RELEASE ==="
mkdir -p "${GITHUB_WORKSPACE}/extracted-games"
else
echo "=== Building for regular build ==="
fi

while IFS= read -r line || [[ -n "$line" ]]; do
gameName=$(echo "$line" | tr -cd '[:alnum:]_-')
appBaseName="MudletBootstrap"
Expand Down Expand Up @@ -166,8 +176,21 @@ while IFS= read -r line || [[ -n "$line" ]]; do

mv "${HOME}/Desktop/${appBaseName}.dmg" "${GITHUB_WORKSPACE}/upload/${appBaseName}-${gameName}.dmg"

# If this is a release, also copy to extracted-games with standardized naming
if [ "$IS_RELEASE" = true ]; then
echo "Creating release version for $gameName"
mkdir -p "${GITHUB_WORKSPACE}/extracted-games/$gameName"
cp "${GITHUB_WORKSPACE}/upload/${appBaseName}-${gameName}.dmg" \
"${GITHUB_WORKSPACE}/extracted-games/$gameName/MudletBootstrap-$gameName-macOS.dmg"
fi

done < "${GITHUB_WORKSPACE}/GameList.txt"

if [ "$IS_RELEASE" = true ]; then
echo "=== Release files created ==="
find "${GITHUB_WORKSPACE}/extracted-games" -type f | sort
fi

{
echo "FOLDER_TO_UPLOAD=${GITHUB_WORKSPACE}/upload"
echo "UPLOAD_FILENAME=${appBaseName}-macOS"
Expand Down
1 change: 0 additions & 1 deletion CI/package-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ while IFS= read -r line || [[ -n "$line" ]]; do

ZIP_FILE_NAME="MudletBootstrap"


# To determine which system libraries have to be copied in it requires
# continually trying to run the executable on the target type system
# and adding in the libraries to the same directory and repeating that
Expand Down
Loading