mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
Merge pull request #2363 from unraid/feat/plugin-pr-builds
feat: add GitHub Actions workflow and script for generating PR plugins
This commit is contained in:
327
.github/scripts/generate-pr-plugin.sh
vendored
Executable file
327
.github/scripts/generate-pr-plugin.sh
vendored
Executable file
@@ -0,0 +1,327 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Generate PR plugin file for Unraid
|
||||
# Usage: ./generate-pr-plugin.sh <version> <pr_number> <commit_sha> <local_tarball> <remote_tarball> <txz_url> [plugin_url]
|
||||
|
||||
VERSION=$1
|
||||
PR_NUMBER=$2
|
||||
COMMIT_SHA=$3
|
||||
LOCAL_TARBALL=$4 # Local file for SHA calculation
|
||||
REMOTE_TARBALL=$5 # Remote filename for download
|
||||
TXZ_URL=$6
|
||||
PLUGIN_URL=${7:-""} # Optional plugin URL for updates
|
||||
|
||||
if [ -z "$VERSION" ] || [ -z "$PR_NUMBER" ] || [ -z "$COMMIT_SHA" ] || [ -z "$LOCAL_TARBALL" ] || [ -z "$REMOTE_TARBALL" ] || [ -z "$TXZ_URL" ]; then
|
||||
echo "Usage: $0 <version> <pr_number> <commit_sha> <local_tarball> <remote_tarball> <txz_url> [plugin_url]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If no plugin URL provided, generate one based on R2 location
|
||||
if [ -z "$PLUGIN_URL" ]; then
|
||||
# Extract base URL from TXZ_URL and use consistent filename
|
||||
PLUGIN_URL=$(echo "$TXZ_URL" | sed "s|\.tar\.gz|.plg|")
|
||||
fi
|
||||
|
||||
# Use consistent filename (no version in filename, version is inside the plugin)
|
||||
PLUGIN_NAME="webgui-pr-${PR_NUMBER}.plg"
|
||||
TARBALL_SHA256=$(sha256sum "$LOCAL_TARBALL" | awk '{print $1}')
|
||||
|
||||
echo "Generating plugin: $PLUGIN_NAME"
|
||||
echo "Tarball SHA256: $TARBALL_SHA256"
|
||||
|
||||
cat > "$PLUGIN_NAME" << 'EOF'
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<!DOCTYPE PLUGIN [
|
||||
<!ENTITY name "webgui-pr-PR_PLACEHOLDER">
|
||||
<!ENTITY version "VERSION_PLACEHOLDER">
|
||||
<!ENTITY author "unraid">
|
||||
<!ENTITY pluginURL "PLUGIN_URL_PLACEHOLDER">
|
||||
<!ENTITY tarball "REMOTE_TARBALL_PLACEHOLDER">
|
||||
<!ENTITY sha256 "SHA256_PLACEHOLDER">
|
||||
<!ENTITY pr "PR_PLACEHOLDER">
|
||||
<!ENTITY commit "COMMIT_PLACEHOLDER">
|
||||
<!ENTITY github "https://github.com/unraid/webgui">
|
||||
]>
|
||||
|
||||
<PLUGIN name="&name;-&version;"
|
||||
author="&author;"
|
||||
version="&version;"
|
||||
pluginURL="&pluginURL;"
|
||||
min="6.12.0"
|
||||
icon="wrench"
|
||||
support="&github;/pull/≺">
|
||||
|
||||
<CHANGES>
|
||||
##&version;
|
||||
- Test build for PR #≺ (commit &commit;)
|
||||
- This plugin installs modified files from the PR for testing
|
||||
- Original files are backed up and restored upon removal
|
||||
</CHANGES>
|
||||
|
||||
<!-- Create backup directory -->
|
||||
<FILE Run="/bin/bash" Method="install">
|
||||
<INLINE>
|
||||
<![CDATA[
|
||||
echo "===================================="
|
||||
echo "WebGUI PR Test Plugin Installation"
|
||||
echo "===================================="
|
||||
echo "Version: VERSION_PLACEHOLDER"
|
||||
echo "PR: #PR_PLACEHOLDER"
|
||||
echo "Commit: COMMIT_PLACEHOLDER"
|
||||
echo ""
|
||||
|
||||
# Create directories
|
||||
mkdir -p /boot/config/plugins/webgui-pr-PR_PLACEHOLDER
|
||||
mkdir -p /boot/config/plugins/webgui-pr-PR_PLACEHOLDER/backups
|
||||
|
||||
echo "Created plugin directories"
|
||||
]]>
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
<!-- Download tarball from GitHub -->
|
||||
<FILE Name="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/REMOTE_TARBALL_PLACEHOLDER">
|
||||
<URL>TXZ_URL_PLACEHOLDER</URL>
|
||||
<SHA256>&sha256;</SHA256>
|
||||
</FILE>
|
||||
|
||||
<!-- Backup and install files -->
|
||||
<FILE Run="/bin/bash" Method="install">
|
||||
<INLINE>
|
||||
<![CDATA[
|
||||
BACKUP_DIR="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/backups"
|
||||
TARBALL="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/REMOTE_TARBALL_PLACEHOLDER"
|
||||
MANIFEST="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/installed_files.txt"
|
||||
|
||||
echo "Starting file deployment..."
|
||||
echo "Tarball: $TARBALL"
|
||||
echo "Backup directory: $BACKUP_DIR"
|
||||
|
||||
# Clear manifest
|
||||
> "$MANIFEST"
|
||||
|
||||
# Get file list first
|
||||
echo "Examining tarball contents..."
|
||||
tar -tzf "$TARBALL" | head -20
|
||||
echo ""
|
||||
|
||||
# Count total files
|
||||
FILE_COUNT=$(tar -tzf "$TARBALL" | grep -v '/$' | wc -l)
|
||||
echo "Total files to process: $FILE_COUNT"
|
||||
echo ""
|
||||
|
||||
# Get file list
|
||||
tar -tzf "$TARBALL" > /tmp/plugin_files.txt
|
||||
|
||||
# Backup original files BEFORE extraction
|
||||
while IFS= read -r file; do
|
||||
# Skip directories
|
||||
if [[ "$file" == */ ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# The tarball contains usr/local/emhttp/... (no leading slash)
|
||||
# When we extract with -C /, it becomes /usr/local/emhttp/...
|
||||
SYSTEM_FILE="/${file}"
|
||||
BACKUP_FILE="$BACKUP_DIR/$(echo "$file" | tr '/' '_')"
|
||||
|
||||
echo "Processing: $file"
|
||||
|
||||
# Only backup if we haven't already backed up this file
|
||||
# (preserves original backups across updates)
|
||||
if [ -f "$BACKUP_FILE" ]; then
|
||||
echo " → Using existing backup: $BACKUP_FILE"
|
||||
echo "$SYSTEM_FILE|$BACKUP_FILE" >> "$MANIFEST"
|
||||
elif [ -f "$SYSTEM_FILE" ]; then
|
||||
echo " → Creating backup of original: $SYSTEM_FILE"
|
||||
cp -p "$SYSTEM_FILE" "$BACKUP_FILE"
|
||||
echo "$SYSTEM_FILE|$BACKUP_FILE" >> "$MANIFEST"
|
||||
else
|
||||
echo " → Will create new: $SYSTEM_FILE"
|
||||
echo "$SYSTEM_FILE|NEW" >> "$MANIFEST"
|
||||
fi
|
||||
done < /tmp/plugin_files.txt
|
||||
|
||||
# Clean up temp file
|
||||
rm -f /tmp/plugin_files.txt
|
||||
|
||||
# Extract the tarball to root with verbose output
|
||||
# Since tarball contains usr/local/emhttp/..., extracting to / makes it /usr/local/emhttp/...
|
||||
echo ""
|
||||
echo "Extracting files to system (verbose mode)..."
|
||||
echo "----------------------------------------"
|
||||
tar -xzvf "$TARBALL" -C /
|
||||
EXTRACT_STATUS=$?
|
||||
echo "----------------------------------------"
|
||||
echo "Extraction completed with status: $EXTRACT_STATUS"
|
||||
echo ""
|
||||
|
||||
# Verify extraction
|
||||
echo "Verifying installation..."
|
||||
INSTALLED_COUNT=0
|
||||
while IFS='|' read -r file backup; do
|
||||
if [ -f "$file" ]; then
|
||||
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
|
||||
fi
|
||||
done < "$MANIFEST"
|
||||
|
||||
echo "Successfully installed $INSTALLED_COUNT files"
|
||||
|
||||
echo ""
|
||||
echo "✅ Installation complete!"
|
||||
echo ""
|
||||
echo "Summary:"
|
||||
echo "--------"
|
||||
echo "Files deployed: $INSTALLED_COUNT"
|
||||
echo ""
|
||||
if [ $INSTALLED_COUNT -gt 0 ]; then
|
||||
echo "Modified files:"
|
||||
while IFS='|' read -r file backup; do
|
||||
if [ -f "$file" ]; then
|
||||
if [ "$backup" == "NEW" ]; then
|
||||
echo " [NEW] $file"
|
||||
else
|
||||
echo " [MOD] $file"
|
||||
fi
|
||||
fi
|
||||
done < "$MANIFEST"
|
||||
else
|
||||
echo "⚠️ WARNING: No files were installed!"
|
||||
echo "Check that the tarball structure matches the expected format."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "⚠️ This is a TEST plugin for PR #PR_PLACEHOLDER"
|
||||
echo "⚠️ Remove this plugin before applying production updates"
|
||||
]]>
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
<!-- Update method - restore originals first, then apply new changes -->
|
||||
<FILE Run="/bin/bash" Method="update">
|
||||
<INLINE>
|
||||
<![CDATA[
|
||||
echo "===================================="
|
||||
echo "WebGUI PR Test Plugin Update"
|
||||
echo "===================================="
|
||||
echo "Version: &version;"
|
||||
echo ""
|
||||
|
||||
BACKUP_DIR="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/backups"
|
||||
MANIFEST="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/installed_files.txt"
|
||||
|
||||
# First restore original files to ensure clean state
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
echo "Step 1: Restoring original files before update..."
|
||||
echo "------------------------------------------------"
|
||||
|
||||
while IFS='|' read -r system_file backup_file; do
|
||||
if [ "$backup_file" == "NEW" ]; then
|
||||
# This was a new file from previous version, remove it
|
||||
if [ -f "$system_file" ]; then
|
||||
echo "Removing PR file: $system_file"
|
||||
rm -f "$system_file"
|
||||
fi
|
||||
else
|
||||
# Restore original from backup
|
||||
if [ -f "$backup_file" ]; then
|
||||
echo "Restoring original: $system_file"
|
||||
cp -f "$backup_file" "$system_file"
|
||||
fi
|
||||
fi
|
||||
done < "$MANIFEST"
|
||||
|
||||
echo ""
|
||||
echo "✅ Original files restored"
|
||||
echo ""
|
||||
else
|
||||
echo "⚠️ No previous manifest found, proceeding with fresh install"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Clear the old manifest for the new version
|
||||
> "$MANIFEST"
|
||||
|
||||
echo "Step 2: Update will now proceed with installation of new PR files..."
|
||||
echo ""
|
||||
]]>
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
<!-- Removal script -->
|
||||
<FILE Run="/bin/bash" Method="remove">
|
||||
<INLINE>
|
||||
<![CDATA[
|
||||
echo "===================================="
|
||||
echo "WebGUI PR Test Plugin Removal"
|
||||
echo "===================================="
|
||||
echo ""
|
||||
|
||||
BACKUP_DIR="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/backups"
|
||||
MANIFEST="/boot/config/plugins/webgui-pr-PR_PLACEHOLDER/installed_files.txt"
|
||||
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
echo "Restoring original files..."
|
||||
|
||||
while IFS='|' read -r system_file backup_file; do
|
||||
if [ "$backup_file" == "NEW" ]; then
|
||||
# This was a new file, remove it
|
||||
if [ -f "$system_file" ]; then
|
||||
echo "Removing new file: $system_file"
|
||||
rm -f "$system_file"
|
||||
fi
|
||||
else
|
||||
# Restore from backup
|
||||
if [ -f "$backup_file" ]; then
|
||||
echo "Restoring: $system_file"
|
||||
mv -f "$backup_file" "$system_file"
|
||||
fi
|
||||
fi
|
||||
done < "$MANIFEST"
|
||||
|
||||
echo ""
|
||||
echo "✅ Original files restored"
|
||||
else
|
||||
echo "⚠️ No manifest found, cannot restore files"
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
echo "Cleaning up plugin files..."
|
||||
# Remove the plugin directory (which includes the tarball and backups)
|
||||
rm -rf "/boot/config/plugins/webgui-pr-PR_PLACEHOLDER"
|
||||
# Remove the plugin file itself
|
||||
rm -f "/boot/config/plugins/webgui-pr-PR_PLACEHOLDER.plg"
|
||||
|
||||
echo ""
|
||||
echo "✅ Plugin removed successfully"
|
||||
]]>
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
</PLUGIN>
|
||||
EOF
|
||||
|
||||
# Replace placeholders (compatible with both Linux and macOS)
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# macOS requires backup extension with -i
|
||||
sed -i '' "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME"
|
||||
sed -i '' "s/REMOTE_TARBALL_PLACEHOLDER/${REMOTE_TARBALL}/g" "$PLUGIN_NAME"
|
||||
sed -i '' "s/SHA256_PLACEHOLDER/${TARBALL_SHA256}/g" "$PLUGIN_NAME"
|
||||
sed -i '' "s/PR_PLACEHOLDER/${PR_NUMBER}/g" "$PLUGIN_NAME"
|
||||
sed -i '' "s/COMMIT_PLACEHOLDER/${COMMIT_SHA}/g" "$PLUGIN_NAME"
|
||||
sed -i '' "s|TXZ_URL_PLACEHOLDER|${TXZ_URL}|g" "$PLUGIN_NAME"
|
||||
sed -i '' "s|PLUGIN_URL_PLACEHOLDER|${PLUGIN_URL}|g" "$PLUGIN_NAME"
|
||||
else
|
||||
# Linux sed
|
||||
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" "$PLUGIN_NAME"
|
||||
sed -i "s/REMOTE_TARBALL_PLACEHOLDER/${REMOTE_TARBALL}/g" "$PLUGIN_NAME"
|
||||
sed -i "s/SHA256_PLACEHOLDER/${TARBALL_SHA256}/g" "$PLUGIN_NAME"
|
||||
sed -i "s/PR_PLACEHOLDER/${PR_NUMBER}/g" "$PLUGIN_NAME"
|
||||
sed -i "s/COMMIT_PLACEHOLDER/${COMMIT_SHA}/g" "$PLUGIN_NAME"
|
||||
sed -i "s|TXZ_URL_PLACEHOLDER|${TXZ_URL}|g" "$PLUGIN_NAME"
|
||||
sed -i "s|PLUGIN_URL_PLACEHOLDER|${PLUGIN_URL}|g" "$PLUGIN_NAME"
|
||||
fi
|
||||
|
||||
echo "Plugin generated: $PLUGIN_NAME"
|
||||
235
.github/workflows/pr-plugin-build.yml
vendored
Normal file
235
.github/workflows/pr-plugin-build.yml
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
name: Build PR Plugin
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'emhttp/**'
|
||||
- '.github/workflows/pr-plugin-build.yml'
|
||||
- '.github/scripts/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
build-plugin:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# Get list of changed files in emhttp directory using PR SHAs
|
||||
git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" | grep '^emhttp/' > changed_files.txt || true
|
||||
|
||||
# Output for debugging
|
||||
echo "Changed files:"
|
||||
cat changed_files.txt
|
||||
|
||||
# Check if we have any changes
|
||||
if [ ! -s "changed_files.txt" ]; then
|
||||
echo "No emhttp files changed"
|
||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Generate plugin version
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
id: version
|
||||
run: |
|
||||
# Generate version with proper timestamp format: YYYY.MM.DD.HHMM
|
||||
VERSION=$(date -u +"%Y.%m.%d.%H%M")
|
||||
# Also keep PR info for reference
|
||||
PR_VERSION="pr.${{ github.event.pull_request.number }}.$(git rev-parse --short HEAD)"
|
||||
|
||||
# Generate URLs with versioned TXZ to prevent SHA conflicts
|
||||
S3_BASE_URL="${{ secrets.CLOUDFLARE_PREVIEW_BUCKET_BASE_URL }}/pr-plugins/pr-${{ github.event.pull_request.number }}"
|
||||
|
||||
# Define filenames
|
||||
LOCAL_TXZ_NAME="webgui-pr-${{ github.event.pull_request.number }}.tar.gz"
|
||||
REMOTE_TXZ_NAME="webgui-pr-${{ github.event.pull_request.number }}-${VERSION}.tar.gz"
|
||||
PLUGIN_NAME="webgui-pr-${{ github.event.pull_request.number }}.plg"
|
||||
|
||||
# TXZ gets unique versioned path to prevent SHA conflicts on updates
|
||||
TXZ_URL="${S3_BASE_URL}/${REMOTE_TXZ_NAME}"
|
||||
PLUGIN_URL="${S3_BASE_URL}/${PLUGIN_NAME}"
|
||||
TXZ_KEY="pr-plugins/pr-${{ github.event.pull_request.number }}/${REMOTE_TXZ_NAME}"
|
||||
PLUGIN_KEY="pr-plugins/pr-${{ github.event.pull_request.number }}/${PLUGIN_NAME}"
|
||||
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "pr_version=$PR_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "local_txz=$LOCAL_TXZ_NAME" >> $GITHUB_OUTPUT
|
||||
echo "remote_txz=$REMOTE_TXZ_NAME" >> $GITHUB_OUTPUT
|
||||
echo "plugin_name=$PLUGIN_NAME" >> $GITHUB_OUTPUT
|
||||
echo "txz_url=$TXZ_URL" >> $GITHUB_OUTPUT
|
||||
echo "plugin_url=$PLUGIN_URL" >> $GITHUB_OUTPUT
|
||||
echo "txz_key=$TXZ_KEY" >> $GITHUB_OUTPUT
|
||||
echo "plugin_key=$PLUGIN_KEY" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: $VERSION (PR: $PR_VERSION)"
|
||||
|
||||
- name: Create plugin package
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
run: |
|
||||
# Create build directory
|
||||
mkdir -p build/usr/local
|
||||
|
||||
# Copy changed files preserving directory structure
|
||||
while IFS= read -r file; do
|
||||
if [ -f "$file" ]; then
|
||||
# Create directory structure in build
|
||||
dir=$(dirname "$file")
|
||||
mkdir -p "build/usr/local/$dir"
|
||||
cp "$file" "build/usr/local/$dir/"
|
||||
echo "Added: $file"
|
||||
fi
|
||||
done < changed_files.txt
|
||||
|
||||
# Create tarball - consistent filename for updates
|
||||
cd build
|
||||
echo "Creating tarball with contents:"
|
||||
find usr/ -type f
|
||||
tar -czf ../${{ steps.version.outputs.local_txz }} usr/
|
||||
cd ..
|
||||
|
||||
# Generate file list for plugin
|
||||
find build/usr/local/emhttp -type f | sed 's|^build||' > file_list.txt
|
||||
echo "File list for plugin:"
|
||||
cat file_list.txt
|
||||
|
||||
# Verify tarball contents
|
||||
echo "Tarball contents:"
|
||||
tar -tzf ${{ steps.version.outputs.local_txz }}
|
||||
|
||||
- name: Configure AWS CLI for R2
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
run: |
|
||||
aws configure set aws_access_key_id ${{ secrets.CLOUDFLARE_PREVIEW_ACCESS_KEY_ID }}
|
||||
aws configure set aws_secret_access_key ${{ secrets.CLOUDFLARE_PREVIEW_SECRET_ACCESS_KEY }}
|
||||
aws configure set region auto
|
||||
|
||||
- name: Upload TXZ to R2
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
id: upload-txz
|
||||
run: |
|
||||
# Upload to R2 with versioned filename to prevent SHA conflicts
|
||||
aws s3 cp "${{ steps.version.outputs.local_txz }}" \
|
||||
"s3://${{ secrets.CLOUDFLARE_PREVIEW_BUCKET_NAME }}/${{ steps.version.outputs.txz_key }}" \
|
||||
--endpoint-url "${{ secrets.CLOUDFLARE_S3_URL }}" \
|
||||
--acl public-read
|
||||
|
||||
echo "Uploaded TXZ to: ${{ steps.version.outputs.txz_url }}"
|
||||
|
||||
- name: Generate plugin file with R2 URL
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
run: |
|
||||
# Local file is non-versioned, but remote URL is versioned
|
||||
# Pass local filename for SHA calculation and remote filename for download
|
||||
bash .github/scripts/generate-pr-plugin.sh \
|
||||
"${{ steps.version.outputs.version }}" \
|
||||
"${{ github.event.pull_request.number }}" \
|
||||
"$(git rev-parse --short HEAD)" \
|
||||
"${{ steps.version.outputs.local_txz }}" \
|
||||
"${{ steps.version.outputs.remote_txz }}" \
|
||||
"${{ steps.version.outputs.txz_url }}" \
|
||||
"${{ steps.version.outputs.plugin_url }}"
|
||||
|
||||
- name: Upload PLG to R2
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
id: upload-plg
|
||||
run: |
|
||||
# Upload PLG - overwrite existing for updates (consistent filename)
|
||||
aws s3 cp "${{ steps.version.outputs.plugin_name }}" \
|
||||
"s3://${{ secrets.CLOUDFLARE_PREVIEW_BUCKET_NAME }}/${{ steps.version.outputs.plugin_key }}" \
|
||||
--endpoint-url "${{ secrets.CLOUDFLARE_S3_URL }}" \
|
||||
--acl public-read
|
||||
|
||||
echo "Uploaded PLG to: ${{ steps.version.outputs.plugin_url }}"
|
||||
|
||||
- name: Upload artifacts to GitHub (backup)
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: webgui-pr-plugin-${{ github.event.pull_request.number }}
|
||||
path: |
|
||||
webgui-pr-*.plg
|
||||
webgui-pr-*.tar.gz
|
||||
retention-days: 30
|
||||
|
||||
- name: Format changed files list
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
id: format-files
|
||||
run: |
|
||||
# Format the file list for the comment
|
||||
echo "files<<EOF" >> $GITHUB_OUTPUT
|
||||
cat changed_files.txt >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
# Debug output
|
||||
echo "Changed files found:"
|
||||
cat changed_files.txt
|
||||
|
||||
- name: Comment on PR
|
||||
if: steps.changed-files.outputs.has_changes == 'true'
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
## 🔧 PR Test Plugin Available
|
||||
|
||||
A test plugin has been generated for this PR that includes the modified files.
|
||||
|
||||
**Version:** `${{ steps.version.outputs.version }}`
|
||||
**Build:** [View Workflow Run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
### 📥 Installation Instructions:
|
||||
|
||||
**Install via Unraid Web UI:**
|
||||
1. Go to **Plugins → Install Plugin**
|
||||
2. Copy and paste this URL:
|
||||
```
|
||||
${{ steps.version.outputs.plugin_url }}
|
||||
```
|
||||
3. Click **Install**
|
||||
|
||||
**Alternative: Direct Download**
|
||||
- [📦 Download PLG](${{ steps.version.outputs.plugin_url }})
|
||||
- [📦 Download TXZ](${{ steps.version.outputs.txz_url }})
|
||||
|
||||
### ⚠️ Important Notes:
|
||||
|
||||
- **Testing only:** This plugin is for testing PR changes
|
||||
- **Backup included:** Original files are automatically backed up
|
||||
- **Easy removal:** Files are restored when plugin is removed
|
||||
- **Conflicts:** Remove this plugin before installing production updates
|
||||
|
||||
### 📝 Modified Files:
|
||||
|
||||
<details>
|
||||
<summary>Click to expand file list</summary>
|
||||
|
||||
```
|
||||
${{ steps.format-files.outputs.files }}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### 🔄 To Remove:
|
||||
|
||||
Navigate to Plugins → Installed Plugins and remove `webgui-pr-${{ steps.version.outputs.version }}`, or run:
|
||||
```bash
|
||||
plugin remove webgui-pr-${{ steps.version.outputs.version }}
|
||||
```
|
||||
|
||||
---
|
||||
<sub>🤖 This comment is automatically generated and will be updated with each new push to this PR.</sub>
|
||||
edit-mode: replace
|
||||
comment-id: deploy-comment
|
||||
Reference in New Issue
Block a user