Compress and Release #36
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: Compress and Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| compress-and-upload: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Generate dynamic tag | |
| run: | | |
| TAG_NAME="release-$(date +'%Y%m%d-%H%M%S')" | |
| echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
| echo "RELEASE_NAME=Release - $(date +'%Y-%m-%d %H:%M:%S')" >> "$GITHUB_ENV" | |
| - name: Extract compressed RetroArch core into system package | |
| run: | | |
| find system/base system/extra -type f -path "*/assign/*.ini" | while IFS= read -r INI; do | |
| SYS_DIR="$(dirname "$(dirname "$(dirname "$INI")")")" | |
| CORE_DIR="$SYS_DIR/core" | |
| CORE_VAL="$(grep '^core=' "$INI" | sed 's/^core=//')" | |
| case "$CORE_VAL" in | |
| *.so) | |
| CORE_SRC="core/${CORE_VAL}.zip" | |
| if [ -f "$CORE_SRC" ]; then | |
| mkdir -p "$CORE_DIR" | |
| unzip -qq -o "$CORE_SRC" -d "$CORE_DIR" || echo "Warning: Failed to unzip $CORE_SRC" | |
| fi | |
| ;; | |
| esac | |
| done | |
| - name: Compress Base and Extra systems | |
| run: | | |
| mkdir -p artifacts | |
| COMPRESS_SYSTEM() { | |
| ROOT="$1" | |
| PREFIX="$2" | |
| [ -d "$ROOT" ] || return | |
| for SYS in "$ROOT"/*; do | |
| [ -d "$SYS" ] || continue | |
| NAME="$(basename "$SYS")" | |
| OUT="artifacts/${PREFIX} - ${NAME}.muxzip" | |
| echo "Compressing: ($PREFIX) $SYS" | |
| ( | |
| cd "$SYS" || exit 1 | |
| zip -r9 "../../../$OUT" ./* >/dev/null 2>&1 || echo "zip failed for $SYS" | |
| ) | |
| done | |
| } | |
| COMPRESS_SYSTEM "system/base" "Base" | |
| COMPRESS_SYSTEM "system/extra" "Extra" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.TAG_NAME }} | |
| name: ${{ env.RELEASE_NAME }} | |
| files: artifacts/*.muxzip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |