🤖 Auto-update server-preview-publicized redist files #183
Workflow file for this run
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: "Verify.Redist.Update" | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - 'redist/**' | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| jobs: | |
| verify: | |
| name: "Verify Redist Update" | |
| runs-on: ubuntu-latest | |
| env: | |
| ALLOW_AUTO_MERGE_REDIST_PR: ${{ vars.ALLOW_AUTO_MERGE_REDIST_PR }} | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Validate redist update | |
| run: | | |
| echo "🔍 Verifying redist update..." | |
| VARIANT=$(echo "${GITHUB_HEAD_REF}" | cut -d'/' -f2 | sed -E 's/-[0-9]{8}-[0-9]{6}$//') | |
| echo "Detected variant: $VARIANT" | |
| case "$VARIANT" in | |
| client-preview) REDIST_DIR="redist/redist-client-preview" ;; | |
| server-preview) REDIST_DIR="redist/redist-server-preview" ;; | |
| client-preview-old) REDIST_DIR="redist/redist-client-preview-old" ;; | |
| server-preview-old) REDIST_DIR="redist/redist-server-preview-old" ;; | |
| client) REDIST_DIR="redist/redist-client" ;; | |
| server) REDIST_DIR="redist/redist-server" ;; | |
| client-publicized) REDIST_DIR="redist/redist-client-publicized" ;; | |
| server-publicized) REDIST_DIR="redist/redist-server-publicized" ;; | |
| client-preview-publicized) REDIST_DIR="redist/redist-client-preview-publicized" ;; | |
| server-preview-publicized) REDIST_DIR="redist/redist-server-preview-publicized" ;; | |
| *) | |
| echo "Unknown variant: $VARIANT" | |
| exit 1 | |
| ;; | |
| esac | |
| echo "📁 Validating redist directory: $REDIST_DIR" | |
| if [ ! -d "$REDIST_DIR" ]; then | |
| echo "❌ Redist directory does not exist: $REDIST_DIR" | |
| exit 1 | |
| fi | |
| echo "✅ Redist directory exists: $REDIST_DIR" | |
| echo "REDIST_DIR=$REDIST_DIR" >> $GITHUB_ENV | |
| - name: Validate DLL and XML files | |
| run: | | |
| echo "📋 Validating DLL and XML documentation files..." | |
| REQUIRED_DLLS=( | |
| "Assembly-CSharp.dll" | |
| "SDG.NetPak.Runtime.dll" | |
| "com.rlabrecque.steamworks.net.dll" | |
| "SDG.Glazier.Runtime.dll" | |
| "SDG.HostBans.Runtime.dll" | |
| "SDG.NetTransport.dll" | |
| "SystemEx.dll" | |
| "UnityEx.dll" | |
| "UnturnedDat.dll" | |
| ) | |
| declare -A DLL_XML_MAPPING=( | |
| ["Assembly-CSharp.dll"]="Assembly-CSharp.xml" | |
| ["SDG.NetPak.Runtime.dll"]="SDG.NetPak.Runtime.xml" | |
| ) | |
| MISSING_DLLS=() | |
| MISSING_XML_FILES=() | |
| echo "🔍 Checking required DLL files..." | |
| for dll_file in "${REQUIRED_DLLS[@]}"; do | |
| if [ -f "$REDIST_DIR/$dll_file" ]; then | |
| echo "✅ Found $dll_file" | |
| else | |
| echo "❌ Missing $dll_file" | |
| MISSING_DLLS+=("$dll_file") | |
| fi | |
| done | |
| echo "🔍 Checking XML documentation files..." | |
| for dll_file in "${!DLL_XML_MAPPING[@]}"; do | |
| xml_file="${DLL_XML_MAPPING[$dll_file]}" | |
| if [ -f "$REDIST_DIR/$dll_file" ]; then | |
| if [ -f "$REDIST_DIR/$xml_file" ]; then | |
| echo "✅ Found $xml_file (for $dll_file)" | |
| else | |
| echo "❌ Missing $xml_file (for $dll_file)" | |
| MISSING_XML_FILES+=("$xml_file") | |
| fi | |
| fi | |
| done | |
| if [ ${#MISSING_DLLS[@]} -eq 0 ] && [ ${#MISSING_XML_FILES[@]} -eq 0 ]; then | |
| echo "✅ All required DLL and XML documentation files are present" | |
| else | |
| if [ ${#MISSING_DLLS[@]} -gt 0 ]; then | |
| echo "" | |
| echo "❌ Missing required DLL files:" | |
| for dll_file in "${MISSING_DLLS[@]}"; do | |
| echo " - $dll_file" | |
| done | |
| fi | |
| if [ ${#MISSING_XML_FILES[@]} -gt 0 ]; then | |
| echo "" | |
| echo "❌ Missing XML documentation files:" | |
| for xml_file in "${MISSING_XML_FILES[@]}"; do | |
| echo " - $xml_file" | |
| done | |
| fi | |
| echo "" | |
| echo "All required files must be present for the redistributable." | |
| exit 1 | |
| fi | |
| - name: Enable PR automerge | |
| if: success() && env.ALLOW_AUTO_MERGE_REDIST_PR == 'true' && github.event.pull_request.user.login == 'rocketmodfixadmin' | |
| uses: peter-evans/enable-pull-request-automerge@v3 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| pull-request-number: ${{ github.event.pull_request.number }} | |
| merge-method: squash | |
| - name: Auto-approve PR | |
| if: success() && env.ALLOW_AUTO_MERGE_REDIST_PR == 'true' && github.event.pull_request.user.login == 'rocketmodfixadmin' | |
| uses: hmarr/auto-approve-action@v4 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| pull-request-number: ${{ github.event.pull_request.number }} | |
| review-message: "All checks passed. Auto approved automated PR." |