Skip to content

Commit 4264735

Browse files
committed
refactor: consolidate GitHub Pages deployment into homebrew workflow
- Replace complex Pages deployment logic in homebrew.yml with simplified version from pages.yml - Remove redundant placeholder replacement logic (already fixed in scripts files) - Use clean and efficient Pages deployment steps - Remove duplicate pages.yml workflow file - Maintain single source of truth for Pages deployment in homebrew workflow
1 parent 726726a commit 4264735

2 files changed

Lines changed: 26 additions & 145 deletions

File tree

.github/workflows/homebrew.yml

Lines changed: 26 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -539,85 +539,35 @@ jobs:
539539
540540
- name: Setup Pages
541541
uses: actions/configure-pages@v4
542-
543-
- name: Prepare GitHub Pages Deployment
542+
543+
- name: Prepare deployment files
544544
run: |
545-
echo "📄 Preparing GitHub Pages deployment..."
546-
547-
# Ensure scripts directory exists
548-
mkdir -p scripts
549-
550-
# Replace repository placeholders with actual values in HTML and scripts
551-
REPO_OWNER="${{ github.repository_owner }}"
552-
REPO_NAME="${{ github.event.repository.name }}"
545+
echo "📁 Preparing GitHub Pages deployment from scripts directory..."
553546
554-
echo "Repository info: $REPO_OWNER/$REPO_NAME"
555-
556-
# Replace placeholders in HTML file
557-
if [[ -f "scripts/index.html" ]]; then
558-
sed -i "s/{{REPO_OWNER}}/$REPO_OWNER/g" scripts/index.html
559-
sed -i "s/{{REPO_NAME}}/$REPO_NAME/g" scripts/index.html
560-
echo "✅ Updated placeholders in scripts/index.html"
547+
# 确保scripts目录存在
548+
if [ ! -d "scripts" ]; then
549+
echo "❌ scripts directory not found!"
550+
exit 1
561551
fi
562552
563-
# Replace placeholders in install script
564-
if [[ -f "scripts/windows" ]]; then
565-
sed -i "s/{{REPO_OWNER}}/$REPO_OWNER/g" scripts/windows
566-
sed -i "s/{{REPO_NAME}}/$REPO_NAME/g" scripts/windows
567-
echo "✅ Updated placeholders in scripts/windows"
568-
fi
553+
# 显示将要部署的文件
554+
echo "Files to be deployed:"
555+
ls -la scripts/
569556
570-
# Update version in install script if this is a tag
571-
if [[ "${{ github.ref_type }}" == "tag" ]]; then
572-
VERSION="${{ github.ref_name }}"
573-
echo "Updating version to: $VERSION"
574-
575-
# Update the fallback version in the install script
576-
if [[ -f "scripts/windows" ]]; then
577-
sed -i "s/v1\.0\.0/$VERSION/g" scripts/windows
578-
echo "✅ Updated fallback version to $VERSION in install script"
579-
fi
580-
581-
# Update latest.json with current version
582-
cat > scripts/latest.json << EOF
583-
{
584-
"version": "$VERSION",
585-
"tag_name": "$VERSION",
586-
"name": "AgbCloud CLI $VERSION",
587-
"published_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
588-
"assets": {
589-
"windows": {
590-
"amd64": {
591-
"name": "agb-${VERSION#v}-windows-amd64.exe",
592-
"download_url": "https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$VERSION/agb-${VERSION#v}-windows-amd64.exe",
593-
"size": 0
594-
},
595-
"arm64": {
596-
"name": "agb-${VERSION#v}-windows-arm64.exe",
597-
"download_url": "https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$VERSION/agb-${VERSION#v}-windows-arm64.exe",
598-
"size": 0
599-
}
600-
}
601-
},
602-
"install_commands": {
603-
"windows": "powershell -Command \\\"irm https://$REPO_OWNER.github.io/$REPO_NAME/windows | iex\\\"",
604-
"windows_with_version": "powershell -Command \\\"irm https://$REPO_OWNER.github.io/$REPO_NAME/windows | iex\\\" -Version $VERSION"
605-
}
606-
}
607-
EOF
608-
echo "✅ Created latest.json with version $VERSION"
557+
# 验证关键文件存在
558+
if [ ! -f "scripts/windows" ]; then
559+
echo "❌ scripts/windows file not found!"
560+
exit 1
609561
fi
610562
611-
# Verify files exist
612-
echo "Files in scripts directory:"
613-
ls -la scripts/
614-
615-
if [[ -f "scripts/windows" ]]; then
616-
echo "Content of scripts/windows (first 10 lines):"
617-
head -10 scripts/windows
563+
if [ ! -f "scripts/index.html" ]; then
564+
echo "❌ scripts/index.html file not found!"
565+
exit 1
618566
fi
619567
620-
- name: Upload Pages Artifact
568+
echo "✅ All required files found"
569+
570+
- name: Upload artifact
621571
uses: actions/upload-pages-artifact@v3
622572
with:
623573
path: ./scripts
@@ -626,6 +576,12 @@ jobs:
626576
id: deployment
627577
uses: actions/deploy-pages@v4
628578

579+
- name: Deployment summary
580+
run: |
581+
echo "🎉 GitHub Pages deployment completed!"
582+
echo "📄 Site URL: ${{ steps.deployment.outputs.page_url }}"
583+
echo "🔗 Install command: powershell -Command \"irm https://litiantian123-code.github.io/agbcloud-cli/windows | iex\""
584+
629585
- name: Validate Official Formula
630586
run: |
631587
echo "🧪 Validating Official Homebrew Formula (Source Build Mode)..."

.github/workflows/pages.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)