1+ name : " Sync to MDK repository"
2+ on :
3+ workflow_run :
4+ workflows : ["Build and deploy project"]
5+ types :
6+ - completed
7+ branches :
8+ - master
9+ env :
10+ TARGET_REPO : ReDevCafe/FantasyLifeI-ModTemplate
11+ jobs :
12+ sync-include :
13+ runs-on : ubuntu-latest
14+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
15+ steps :
16+ - name : Checkout repo API (ModLoader)
17+ uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
20+ path : repo-api
21+
22+ - name : Verify include folder exists
23+ run : |
24+ if [ ! -d "repo-api/include" ]; then
25+ echo "Error: include folder not found in source repo"
26+ exit 1
27+ fi
28+ echo "Include folder found, contents:"
29+ ls -la repo-api/include
30+
31+ - name : Get release tag from cd.yml
32+ id : version
33+ run : |
34+ TAG="v$(date +'%Y%m%d.%H%M')"
35+ echo "tag=$TAG" >> $GITHUB_OUTPUT
36+ echo "Release tag: $TAG"
37+
38+ - name : Checkout repo MDK (FLiMod template)
39+ uses : actions/checkout@v4
40+ with :
41+ repository : ${{ env.TARGET_REPO }}
42+ token : ${{ secrets.REPO_MDK_PAT }}
43+ path : repo-mdk
44+ fetch-depth : 0
45+
46+ - name : Update include folder
47+ run : |
48+ echo "Removing old include folder..."
49+ rm -rf repo-mdk/include/*
50+ rm -rf repo-mdk/include/.[!.]*
51+
52+ echo "Copying new include folder..."
53+ cp -r repo-api/include/* repo-mdk/include/
54+
55+ echo "Include folder updated, new contents:"
56+ ls -la repo-mdk/include
57+
58+ - name : Update MODLOADER_BUILD_VERSION in CMakeLists.txt
59+ working-directory : repo-mdk
60+ run : |
61+ TAG="${{ steps.version.outputs.tag }}"
62+ sed -i "s/set(MODLOADER_BUILD_VERSION[[:space:]]*\"[^\"]*\")/set(MODLOADER_BUILD_VERSION \"$TAG\")/" CMakeLists.txt
63+ grep "MODLOADER_BUILD_VERSION" CMakeLists.txt
64+
65+ - name : Commit and push to main
66+ working-directory : repo-mdk
67+ run : |
68+ git config user.name "github-actions[bot]"
69+ git config user.email "github-actions[bot]@users.noreply.github.com"
70+
71+ git add include CMakeLists.txt
72+
73+ if ! git diff --staged --quiet; then
74+ git commit -m "Update ModLoader to ${{ steps.version.outputs.tag }}
75+
76+ - Updated include headers
77+ - Updated MODLOADER_BUILD_VERSION in CMakeLists.txt"
78+ git push origin main
79+ else
80+ echo "No changes to commit"
81+ fi
82+
83+ - name : Create versioned branch
84+ working-directory : repo-mdk
85+ run : |
86+ TAG="${{ steps.version.outputs.tag }}"
87+ BRANCH_NAME="modloader-$TAG"
88+
89+ git checkout -b $BRANCH_NAME
90+ git push origin $BRANCH_NAME
0 commit comments