|
1 | | -name: Release Validation |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | release: |
5 | 5 | types: [published, prereleased] |
6 | 6 | workflow_dispatch: |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - # Validate release |
10 | | - release-validation: |
11 | | - name: Release Validation |
12 | | - runs-on: ${{ matrix.os }} |
13 | | - strategy: |
14 | | - matrix: |
15 | | - os: [ubuntu-latest, macos-latest] |
16 | | - |
| 9 | + # Validate release readiness |
| 10 | + release-check: |
| 11 | + name: Release Readiness Check |
| 12 | + runs-on: ubuntu-latest |
17 | 13 | steps: |
18 | 14 | - name: Checkout Repository |
19 | 15 | uses: actions/checkout@v4 |
20 | 16 |
|
21 | | - - name: Validate Release Version |
| 17 | + - name: Verify Release Assets |
| 18 | + run: | |
| 19 | + echo "=== Verifying Release Assets ===" |
| 20 | +
|
| 21 | + # Check required files exist |
| 22 | + required_files=( |
| 23 | + "phpvm.sh" |
| 24 | + "install.sh" |
| 25 | + "README.MD" |
| 26 | + "CHANGELOG.md" |
| 27 | + "LICENSE" |
| 28 | + ) |
| 29 | +
|
| 30 | + for file in "${required_files[@]}"; do |
| 31 | + if [ -f "$file" ]; then |
| 32 | + echo "✓ $file exists" |
| 33 | + else |
| 34 | + echo "✗ Missing required file: $file" |
| 35 | + exit 1 |
| 36 | + fi |
| 37 | + done |
| 38 | +
|
| 39 | + - name: Validate Version Consistency |
22 | 40 | run: | |
23 | | - echo "=== Validating Release Version ===" |
| 41 | + echo "=== Validating Version Consistency ===" |
24 | 42 |
|
25 | 43 | chmod +x ./phpvm.sh |
26 | | -
|
27 | | - # Check version output |
28 | 44 | VERSION_OUTPUT=$(./phpvm.sh version) |
29 | | - echo "Version output: $VERSION_OUTPUT" |
| 45 | + echo "Script version: $VERSION_OUTPUT" |
30 | 46 |
|
31 | | - if echo "$VERSION_OUTPUT" | grep -q "phpvm version"; then |
32 | | - echo "Version output format is correct" |
33 | | - else |
34 | | - echo "Version output format is incorrect" |
35 | | - exit 1 |
36 | | - fi |
37 | | -
|
38 | | - - name: Test Core Functionality |
39 | | - run: | |
40 | | - echo "=== Testing Core Functionality ===" |
| 47 | + # Extract version from output |
| 48 | + SCRIPT_VERSION=$(echo "$VERSION_OUTPUT" | grep -oP 'version \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown") |
41 | 49 |
|
42 | | - ./phpvm.sh version |
43 | | - ./phpvm.sh help |
44 | | - ./phpvm.sh list |
45 | | - ./phpvm.sh test |
| 50 | + # Check if CHANGELOG mentions recent version |
| 51 | + if [ -f CHANGELOG.md ]; then |
| 52 | + echo "Checking CHANGELOG for version information..." |
| 53 | + head -n 20 CHANGELOG.md |
| 54 | + fi |
46 | 55 |
|
47 | | - echo "All core commands work" |
| 56 | + echo "✓ Version validation completed" |
48 | 57 |
|
49 | | - - name: Performance Check |
| 58 | + - name: Verify Documentation |
50 | 59 | run: | |
51 | | - echo "=== Performance Check ===" |
52 | | -
|
53 | | - time ./phpvm.sh version >/dev/null |
54 | | - time ./phpvm.sh help >/dev/null |
55 | | -
|
56 | | - echo "Performance check completed" |
| 60 | + echo "=== Verifying Documentation ===" |
| 61 | +
|
| 62 | + # Check README has essential sections |
| 63 | + sections=("Installation" "Usage" "Commands") |
| 64 | +
|
| 65 | + for section in "${sections[@]}"; do |
| 66 | + if grep -qi "$section" README.MD; then |
| 67 | + echo "✓ README contains $section section" |
| 68 | + else |
| 69 | + echo "⚠ README might be missing $section section" |
| 70 | + fi |
| 71 | + done |
| 72 | +
|
| 73 | + echo "✓ Documentation verification completed" |
| 74 | +
|
| 75 | + # Create release artifacts |
| 76 | + release-artifacts: |
| 77 | + name: Generate Release Artifacts |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: release-check |
| 80 | + steps: |
| 81 | + - name: Checkout Repository |
| 82 | + uses: actions/checkout@v4 |
57 | 83 |
|
58 | | - - name: Documentation Check |
59 | | - if: runner.os == 'Linux' |
| 84 | + - name: Package Release |
60 | 85 | run: | |
61 | | - echo "=== Documentation Check ===" |
62 | | -
|
63 | | - # Check that README contains key commands |
64 | | - if grep -q "phpvm version" README.MD; then |
65 | | - echo "README contains version command documentation" |
66 | | - else |
67 | | - echo "README might be missing version command documentation" |
68 | | - fi |
69 | | -
|
70 | | - if grep -q "phpvm install" README.MD; then |
71 | | - echo "README contains install command documentation" |
72 | | - else |
73 | | - echo "README missing install command documentation" |
74 | | - exit 1 |
75 | | - fi |
76 | | -
|
77 | | - # Check changelog exists |
78 | | - if [ -f CHANGELOG.md ]; then |
79 | | - echo "Changelog file exists" |
80 | | - else |
81 | | - echo "Changelog file missing" |
82 | | - exit 1 |
83 | | - fi |
84 | | -
|
85 | | - echo "Documentation check completed" |
| 86 | + echo "=== Packaging Release ===" |
| 87 | +
|
| 88 | + # Create release package |
| 89 | + mkdir -p dist |
| 90 | + cp phpvm.sh dist/ |
| 91 | + cp install.sh dist/ |
| 92 | + cp README.MD dist/ |
| 93 | + cp LICENSE dist/ |
| 94 | + cp CHANGELOG.md dist/ |
| 95 | +
|
| 96 | + # Create tarball |
| 97 | + tar -czf phpvm-release.tar.gz -C dist . |
| 98 | +
|
| 99 | + echo "✓ Release package created: phpvm-release.tar.gz" |
| 100 | + ls -lh phpvm-release.tar.gz |
| 101 | +
|
| 102 | + - name: Upload Release Artifact |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: phpvm-release |
| 106 | + path: phpvm-release.tar.gz |
| 107 | + retention-days: 90 |
| 108 | + |
| 109 | + # Post-release notification |
| 110 | + release-notify: |
| 111 | + name: Release Notification |
| 112 | + runs-on: ubuntu-latest |
| 113 | + needs: [release-check, release-artifacts] |
| 114 | + if: github.event_name == 'release' |
| 115 | + steps: |
| 116 | + - name: Release Summary |
| 117 | + run: | |
| 118 | + echo "=== Release Summary ===" |
| 119 | + echo "Release: ${{ github.event.release.tag_name }}" |
| 120 | + echo "Type: ${{ github.event.release.prerelease && 'Pre-release' || 'Release' }}" |
| 121 | + echo "URL: ${{ github.event.release.html_url }}" |
| 122 | + echo "" |
| 123 | + echo "✅ All release checks passed!" |
| 124 | + echo "✅ Release artifacts generated!" |
| 125 | + echo "✅ phpvm ${{ github.event.release.tag_name }} is ready!" |
0 commit comments