1- name : Build [All]
1+ name : Build PS2 Exploits Installer
22
33on :
4- workflow_dispatch :
4+ workflow_dispatch : # Allows manual triggering
55 push :
66 paths :
77 - ' installer/**'
88 - ' installer_res/**'
99 - ' .github/workflows/compile-core.yml'
1010 schedule :
11- - cron : " 0 15 1 * *"
11+ - cron : " 0 15 1 * *" # Runs at 3 PM UTC on the 1st of every month
1212
1313jobs :
1414 build-packages :
1515 runs-on : ubuntu-latest
16- container : ps2dev/ps2dev:v1.0
16+ container : ps2dev/ps2dev:v1.0 # Uses a Docker container with PS2SDK pre-installed
17+
1718 steps :
18- - name : Install dependencies
19- run : apk add --no-cache build-base git zip p7zip
19+ - name : Install build dependencies
20+ run : apk add --no-cache build-base git zip p7zip tar # Added tar for .tar.gz
2021
21- - uses : actions/checkout@v4
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
2224 with :
23- fetch-depth : 0
25+ fetch-depth : 0 # Fetch all history for changelog generation
2426
2527 - name : Generate build metadata
28+ id : metadata
2629 run : |
2730 echo "SHA8=${GITHUB_SHA::8}" >> $GITHUB_ENV
31+ # BUILD_TS will be YYYY-MM-DD_HH-MM-SS
2832 echo "BUILD_TS=$(date +'%Y-%m-%d_%H-%M-%S')" >> $GITHUB_ENV
33+ # DATE_FLAT will be YYYY-MM-DD, used for the internal folder name by pack.sh
34+ echo "DATE_FLAT=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
35+ echo "::set-output name=sha8::${GITHUB_SHA::8}"
36+ echo "::set-output name=build_ts::$(date +'%Y-%m-%d_%H-%M-%S')"
37+ echo "::set-output name=date_flat::$(date +'%Y-%m-%d')"
2938
30- - name : Compile
39+ - name : Compile Installer ELFs
40+ env :
41+ FMCB_INSTALLER_VERSION : ${{ steps.metadata.outputs.sha8 }} # Pass SHA8 as version
3142 run : |
3243 cd installer
33- make rebuild FMCB_INSTALLER_VERSION=${{ env.SHA8 }} EE_BIN_DIR=../installer_res/
34- make rebuild FMCB_INSTALLER_VERSION=${{ env.SHA8 }} EE_BIN_DIR=../installer_res/ EXFAT=1
44+ echo "Building standard ELF (output to ../installer_res/)..."
45+ make rebuild EE_BIN_DIR=../installer_res/
46+ echo "Building exFAT ELF (output to ../installer_res/)..."
47+ make rebuild EE_BIN_DIR=../installer_res/ EXFAT=1
48+ cd ..
3549
36- - name : Prepare folder for Release
50+ - name : Run pack.sh to create initial archives
51+ env :
52+ SHA8 : ${{ steps.metadata.outputs.sha8 }} # Pass SHA8 to pack.sh for commit.txt
3753 run : |
3854 cd installer_res
3955 chmod +x ./pack.sh
40- ./pack.sh
41- mkdir -p ../release_artifacts
42- mv ../ FMCB-1966.7z ../release_artifacts/OSDMenu-Installer-${{ env.BUILD_TS }}.7z
56+ ./pack.sh # This script creates archives like ../FMCB-1966.7z
57+ cd ..
58+ # The primary output we care about is FMCB-1966.7z, created in project root by pack.sh
4359
44- - name : Upload artifact
60+ - name : Prepare and Repackage Release
61+ id : repackage
62+ run : |
63+ INITIAL_ARCHIVE_NAME="FMCB-1966.7z" # This is what pack.sh creates in project root for the main package
64+ TEMP_EXTRACT_DIR="temp_extract_for_repack"
65+ FINAL_CONTENT_DIR_BASENAME="OSDMenu-Installer" # pack.sh creates this folder name base for the 1966 version
66+ FINAL_CONTENT_DIR="${FINAL_CONTENT_DIR_BASENAME}-${{ steps.metadata.outputs.date_flat }}" # e.g., OSDMenu-Installer-2025-05-09
67+
68+ RELEASE_ARTIFACTS_DIR="release_artifacts"
69+ mkdir -p ${RELEASE_ARTIFACTS_DIR}
70+
71+ echo "Initial archive from pack.sh: ${INITIAL_ARCHIVE_NAME}"
72+ if [ ! -f "${INITIAL_ARCHIVE_NAME}" ]; then
73+ echo "Error: ${INITIAL_ARCHIVE_NAME} not found after pack.sh execution!"
74+ exit 1
75+ fi
76+
77+ echo "Creating temporary extraction directory: ${TEMP_EXTRACT_DIR}"
78+ mkdir -p ${TEMP_EXTRACT_DIR}
79+ cd ${TEMP_EXTRACT_DIR}
80+
81+ echo "Extracting ${INITIAL_ARCHIVE_NAME}..."
82+ 7z x ../${INITIAL_ARCHIVE_NAME}
83+
84+ if [ ! -d "${FINAL_CONTENT_DIR}" ]; then
85+ echo "Error: Expected directory ${FINAL_CONTENT_DIR} not found after extraction!"
86+ ls -la # List contents for debugging
87+ exit 1
88+ fi
89+
90+ echo "Changing to content directory: ${FINAL_CONTENT_DIR}"
91+ cd "${FINAL_CONTENT_DIR}"
92+
93+ # Define new base name for repackaged archives
94+ REPACK_BASE_NAME="PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}"
95+
96+ echo "Creating .zip archive: ../../${RELEASE_ARTIFACTS_DIR}/${REPACK_BASE_NAME}.zip"
97+ zip -r9 ../../${RELEASE_ARTIFACTS_DIR}/${REPACK_BASE_NAME}.zip .
98+
99+ echo "Creating .7z archive: ../../${RELEASE_ARTIFACTS_DIR}/${REPACK_BASE_NAME}.7z"
100+ 7z a -t7z -mx=9 ../../${RELEASE_ARTIFACTS_DIR}/${REPACK_BASE_NAME}.7z .
101+
102+ echo "Creating .tar.gz archive: ../../${RELEASE_ARTIFACTS_DIR}/${REPACK_BASE_NAME}.tar.gz"
103+ tar -czvf ../../${RELEASE_ARTIFACTS_DIR}/${REPACK_BASE_NAME}.tar.gz .
104+
105+ cd ../../ # Back to project root
106+ rm -rf ${TEMP_EXTRACT_DIR} # Clean up temporary directory
107+
108+ echo "Repackaging complete. New archives are in ${RELEASE_ARTIFACTS_DIR}/"
109+ ls -la ${RELEASE_ARTIFACTS_DIR}/
110+
111+ - name : Upload Repackaged Artifacts
45112 if : success()
46113 uses : actions/upload-artifact@v4
47114 with :
48- name : FMCB-${{ env.SHA8 }}
49- path : release_artifacts/OSDMenu-Installer-${{ env.BUILD_TS }}.7z
115+ name : PS2-Exploits-Installer-${{ steps.metadata.outputs.sha8 }}
116+ path : |
117+ release_artifacts/PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}.zip
118+ release_artifacts/PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}.7z
119+ release_artifacts/PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}.tar.gz
120+ retention-days : 7
50121
51122 - name : Generate changelog since last tag
52123 id : changelog
@@ -61,20 +132,30 @@ jobs:
61132 else
62133 LOG_BODY="$(git log --pretty=format:"- %s (%h) by %an")"
63134 fi
135+
136+ # Escape special characters for multiline JSON string
137+ LOG_BODY="${LOG_BODY//'%'/'%25'}"
138+ LOG_BODY="${LOG_BODY//$'\n'/'%0A'}"
139+ LOG_BODY="${LOG_BODY//$'\r'/'%0D'}"
64140
65- echo 'RELEASE_BODY<<EOF' >> $GITHUB_ENV
66- echo "$LOG_BODY" >> $GITHUB_ENV
67- echo 'EOF' >> $GITHUB_ENV
141+ echo "::set-output name=body::$LOG_BODY"
68142
69- - name : Create release
70- uses : marvinpinto/action-automatic-releases@latest
143+ - name : Create GitHub Release
144+ if : success() # Only run if previous steps were successful
145+ uses : marvinpinto/action-automatic-releases@latest # Or your preferred release action
71146 with :
72147 repo_token : " ${{ secrets.GITHUB_TOKEN }}"
73- automatic_release_tag : " OSDMenu "
148+ automatic_release_tag : " Tuna-v${{ steps.metadata.outputs.build_ts }} " # Use a dynamic tag like Tuna-vYYYY-MM-DD_HH-MM-SS
74149 prerelease : true
75- title : " OSDMenu Installer"
150+ title : " PS2 Exploits Installer (Build ${{ steps.metadata.outputs.build_ts }}) "
76151 files : |
77- release_artifacts/OSDMenu-Installer-${{ env.BUILD_TS }}.7z
152+ release_artifacts/PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}.zip
153+ release_artifacts/PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}.7z
154+ release_artifacts/PS2-Exploits-Installer-${{ steps.metadata.outputs.build_ts }}.tar.gz
78155 body : |
156+ Automated pre-release build.
157+ Commit: ${{ steps.metadata.outputs.sha8 }}
158+ Build Timestamp: ${{ steps.metadata.outputs.build_ts }}
159+
79160 ### Recent Changes:
80- ${{ env.RELEASE_BODY }}
161+ ${{ steps.changelog.outputs.body }}
0 commit comments