Add issue and discussion links to release notes #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: RPG Maker XP Release | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Build Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| IGNORED_PATHS="README.md|LICENSE|images/|\.github/|\.gitattributes|\.gitignore" | |
| # ── Script-Beschreibungen für Release Notes | |
| declare -A SCRIPT_DESC | |
| SCRIPT_DESC["Player Jump System"]="Player Jump System with cooldown mechanics and collision detection for enhanced movement" | |
| SCRIPT_DESC["Player HUD System"]="Real-Time HUD Display showing party member HP/SP bars during map exploration" | |
| SCRIPT_DESC["BGM Player Menu"]="BGM Player Menu with interactive music browser and volume/pitch controls" | |
| SCRIPT_DESC["Typewriter Message System"]="Typewriter Message System for character-by-character text display with sound effects" | |
| SCRIPT_DESC["Enhanced Menu Windows"]="Enhanced Menu Windows with icon integration for Gold, Steps, and PlayTime displays" | |
| SCRIPT_DESC["Visual Timer System"]="Visual Timer System with warning effects, color changes, and sound alerts" | |
| SCRIPT_DESC["Grid Save System"]="Grid Save System featuring 2x2 save file layout with confirmation dialogs" | |
| SCRIPT_DESC["Horizontal Title Menu"]="Horizontal Title Menu with side-by-side menu options and individual window styling" | |
| SCRIPT_DESC["Transparent Menu System"]="Transparent Menu System with background visibility and improved window layouts" | |
| SCRIPT_DESC["Bestiary System"]="Bestiary System with enemy tracking, detailed stats, rewards, and visual representations" | |
| SCRIPT_DESC["Item Popup System"]="Item Popup System with slide-in windows for chest/event rewards, stacking support, and automatic item management" | |
| get_desc() { | |
| local key="$1" | |
| if [ -n "${SCRIPT_DESC[$key]+x}" ]; then | |
| echo "${SCRIPT_DESC[$key]}" | |
| else | |
| echo "$key" | |
| fi | |
| } | |
| # ── Letzten Release-Tag ermitteln | |
| LATEST_TAG=$(git tag -l 'v*-scripts' --sort=-v:refname | head -n1 || true) | |
| if [ -z "$LATEST_TAG" ]; then | |
| IS_FIRST_RELEASE=true | |
| NEW_VERSION="v1.0.0" | |
| DIFF=$(find . -name "*.rb" -not -path "./.git/*" | sed 's|^\./||' | sed 's/^/A\t/') | |
| else | |
| IS_FIRST_RELEASE=false | |
| LAST_SHA=$(git rev-list -n1 "$LATEST_TAG" 2>/dev/null || true) | |
| if [ -z "$LAST_SHA" ] || ! git cat-file -e "$LAST_SHA" 2>/dev/null; then | |
| IS_FIRST_RELEASE=true | |
| NEW_VERSION="v1.0.0" | |
| DIFF=$(find . -name "*.rb" -not -path "./.git/*" | sed 's|^\./||' | sed 's/^/A\t/') | |
| else | |
| DIFF=$(git diff --name-status "$LAST_SHA" HEAD -- '*.rb' | grep -vP "\t($IGNORED_PATHS)" || echo "") | |
| fi | |
| if [ "$IS_FIRST_RELEASE" = false ]; then | |
| CURRENT=$(echo "$LATEST_TAG" | sed 's/^v//' | sed 's/-scripts$//') | |
| MAJOR=$(echo "$CURRENT" | cut -d. -f1) | |
| MINOR=$(echo "$CURRENT" | cut -d. -f2) | |
| PATCH=$(echo "$CURRENT" | cut -d. -f3) | |
| HAS_NEW_FOLDER=false | |
| if [ -n "$DIFF" ]; then | |
| while IFS=$'\t' read -r status filepath; do | |
| if [[ "$status" == A* ]]; then | |
| folder=$(echo "$filepath" | cut -d'/' -f1) | |
| if ! git ls-tree --name-only "$LAST_SHA" | grep -qF "$folder"; then | |
| HAS_NEW_FOLDER=true | |
| break | |
| fi | |
| fi | |
| done <<< "$DIFF" | |
| fi | |
| if [ "$HAS_NEW_FOLDER" = true ]; then | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| else | |
| PATCH=$((PATCH + 1)) | |
| fi | |
| NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |
| fi | |
| fi | |
| TAG_NAME="${NEW_VERSION}-scripts" | |
| if [ -z "$DIFF" ]; then | |
| echo "No script changes detected. Skipping release." | |
| exit 0 | |
| fi | |
| # ── Kategorien vorbereiten (dedupliziert nach Ordner) | |
| declare -A folder_status | |
| declare -a folder_order=() | |
| while IFS=$'\t' read -r status filepath; do | |
| [ -z "$status" ] && continue | |
| folder=$(echo "$filepath" | cut -d'/' -f1) | |
| readable=$(echo "$folder" | sed 's/^[0-9]*-//' | sed 's/-/ /g') | |
| if [ -z "${folder_status[$readable]+x}" ]; then | |
| folder_order+=("$readable") | |
| case "$status" in | |
| A*) folder_status[$readable]="added" ;; | |
| D*) folder_status[$readable]="removed" ;; | |
| *) folder_status[$readable]="modified" ;; | |
| esac | |
| else | |
| if [[ "$status" == A* && "${folder_status[$readable]}" != "added" ]]; then | |
| folder_status[$readable]="added" | |
| fi | |
| fi | |
| done <<< "$DIFF" | |
| count_added=0 | |
| count_modified=0 | |
| count_removed=0 | |
| for key in "${folder_order[@]}"; do | |
| case "${folder_status[$key]}" in | |
| added) count_added=$((count_added + 1)) ;; | |
| modified) count_modified=$((count_modified + 1)) ;; | |
| removed) count_removed=$((count_removed + 1)) ;; | |
| esac | |
| done | |
| total_systems=${#folder_order[@]} | |
| # ── Release Notes zusammenbauen | |
| BODY="" | |
| RELEASE_DATE=$(date -u +"%d-%m-%Y") | |
| RELEASE_TIME=$(date -u +"%I:%M %p UTC") | |
| BODY+="**Release: $RELEASE_DATE at $RELEASE_TIME**"$'\n\n' | |
| if [ "$IS_FIRST_RELEASE" = true ]; then | |
| BODY+="This release introduces ${total_systems} RPG Maker XP scripts designed to improve gameplay mechanics and visual presentation. Each script is a drop-in replacement that maintains full compatibility with the standard RPG Maker XP framework while adding new functionality."$'\n\n' | |
| for s in "${folder_order[@]}"; do | |
| desc=$(get_desc "$s") | |
| BODY+="• ⠀Added ${desc}"$'\n' | |
| done | |
| else | |
| parts=() | |
| [ $count_added -gt 0 ] && parts+=("$count_added added") | |
| [ $count_modified -gt 0 ] && parts+=("$count_modified updated") | |
| [ $count_removed -gt 0 ] && parts+=("$count_removed removed") | |
| summary=$(IFS=", "; echo "${parts[*]}") | |
| BODY+="This release includes ${summary} script(s)."$'\n\n' | |
| for s in "${folder_order[@]}"; do | |
| desc=$(get_desc "$s") | |
| case "${folder_status[$s]}" in | |
| added) BODY+="• ⠀Added ${desc}"$'\n' ;; | |
| modified) BODY+="• ⠀Enhanced ${desc}"$'\n' ;; | |
| removed) BODY+="• ⠀Removed ~~${desc}~~"$'\n' ;; | |
| esac | |
| done | |
| fi | |
| BODY+=$'\n'"**Note:** If you encounter any bugs or issues, please don't hesitate to open an [issue](https://github.com/BerndHagen/RPG-Maker-XP-Script-Library/issues). For any questions or to start a discussion, feel free to initiate a [discussion](https://github.com/BerndHagen/RPG-Maker-XP-Script-Library/discussions) on the GitHub repository." | |
| # ── Release-Assets sammeln (einzelne .rb Dateien) | |
| ASSET_FILES=() | |
| while IFS=$'\t' read -r status filepath; do | |
| [ -z "$status" ] && continue | |
| [[ "$status" == D* ]] && continue | |
| [ -f "$filepath" ] && ASSET_FILES+=("$filepath") | |
| done <<< "$DIFF" | |
| if [ ${#ASSET_FILES[@]} -eq 0 ]; then | |
| echo "No files to include in the release." | |
| exit 0 | |
| fi | |
| echo "Assets to upload (${#ASSET_FILES[@]}):" | |
| printf " %s\n" "${ASSET_FILES[@]}" | |
| # ── Release erstellen | |
| echo "$BODY" > /tmp/release_notes.md | |
| echo "" | |
| echo "Release Notes:" | |
| cat /tmp/release_notes.md | |
| echo "" | |
| echo "Creating release: $TAG_NAME" | |
| gh release create "$TAG_NAME" \ | |
| "${ASSET_FILES[@]}" \ | |
| --title "RPG Maker XP Script Library $NEW_VERSION" \ | |
| --notes-file /tmp/release_notes.md \ | |
| --latest | |
| echo "Release '$TAG_NAME' created successfully!" |