Merge branch 'main' of https://github.com/AgentKush/Icarus-mods #39
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: Auto Release | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - '*/*.EXMOD' | |
| - '*/*.EXMODZ' | |
| jobs: | |
| detect-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - name: Detect changed mods | |
| id: detect | |
| run: | | |
| # Find EXMOD/EXMODZ files that changed in this push | |
| CHANGED=$(git diff --name-only HEAD~1 HEAD -- '*/*.EXMOD' '*/*.EXMODZ' 2>/dev/null || echo "") | |
| if [ -z "$CHANGED" ]; then | |
| echo "No mod files changed" | |
| echo "mods=" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Extract unique folder names | |
| FOLDERS=$(echo "$CHANGED" | sed 's|/.*||' | sort -u | tr '\n' ' ') | |
| echo "Changed mod folders: $FOLDERS" | |
| echo "mods=$FOLDERS" >> $GITHUB_OUTPUT | |
| - name: Create releases | |
| if: steps.detect.outputs.mods != '' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| for FOLDER in ${{ steps.detect.outputs.mods }}; do | |
| EXMOD="$FOLDER/$FOLDER.EXMOD" | |
| EXMODZ="$FOLDER/$FOLDER.EXMODZ" | |
| if [ ! -f "$EXMOD" ]; then | |
| echo "Skipping $FOLDER - no EXMOD found" | |
| continue | |
| fi | |
| # Extract version and name from EXMOD | |
| VERSION=$(python3 -c "import json; print(json.load(open('$EXMOD'))['version'])") | |
| NAME=$(python3 -c "import json; print(json.load(open('$EXMOD'))['name'])") | |
| TAG="${FOLDER}-v${VERSION}" | |
| # Check if release already exists | |
| if gh release view "$TAG" > /dev/null 2>&1; then | |
| echo "Release $TAG already exists, skipping" | |
| continue | |
| fi | |
| # Get description | |
| DESC=$(python3 -c " | |
| import json | |
| d = json.load(open('$EXMOD')) | |
| desc = d.get('description','') | |
| parts = desc.split('\r\n\r\n\r\n', 1) | |
| print(parts[0].replace('\r\n', ' ')) | |
| ") | |
| # Build release body | |
| BODY="## $NAME v$VERSION | |
| $DESC | |
| ### Installation | |
| 1. Download \`$FOLDER.EXMODZ\` below | |
| 2. Open [JimK72's Icarus Mod Manager](https://github.com/Jimk72/Icarus_Software) | |
| 3. Import the \`.EXMODZ\` file, enable, and Merge | |
| 4. Launch Icarus | |
| --- | |
| [](https://buymeacoffee.com/agentkush)" | |
| # Create release | |
| if [ -f "$EXMODZ" ]; then | |
| gh release create "$TAG" "$EXMODZ" \ | |
| --title "$NAME v$VERSION" \ | |
| --notes "$BODY" | |
| echo "Created release: $NAME v$VERSION with EXMODZ" | |
| else | |
| gh release create "$TAG" \ | |
| --title "$NAME v$VERSION" \ | |
| --notes "$BODY" | |
| echo "Created release: $NAME v$VERSION (no EXMODZ)" | |
| fi | |
| done |