11name : Publish gRPC to GitHub Releases
22
33on :
4- # ✅ Trigger otomatis setelah build-grpc.yml selesai
4+ # Auto-trigger setelah build-grpc.yml selesai
55 workflow_run :
66 workflows : ["Build gRPC PHP (Ubuntu 22.04 Multi-Arch)"]
77 types : [completed]
8- branches : [main]
98
10- # Manual trigger untuk publish dengan versi spesifik
9+ # Manual trigger untuk publish
1110 workflow_dispatch :
1211 inputs :
1312 run_id :
14- description : ' Run ID dari workflow build-grpc (kosongkan untuk auto-detect yang terbaru )'
13+ description : ' Run ID dari workflow build-grpc (kosongkan untuk auto-detect)'
1514 required : false
1615
1716jobs :
1817 publish-release :
1918 name : Publish to GitHub Releases
2019 runs-on : ubuntu-latest
20+ if : github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
2121
2222 steps :
2323 - name : Checkout code
@@ -37,22 +37,22 @@ jobs:
3737 RUN_ID="${{ github.event.workflow_run.id }}"
3838 else
3939 # Cari run yang paling baru dan berhasil
40- echo "🔍 Searching for latest successful build..."
40+ echo "Searching for latest successful build..."
4141 RUN_ID=$(gh run list \
4242 --workflow build-grpc.yml \
4343 --status success \
4444 --json databaseId \
4545 --jq ".[0].databaseId")
4646
4747 if [ -z "$RUN_ID" ]; then
48- echo "❌ No successful build found!"
48+ echo "ERROR: No successful build found!"
4949 exit 1
5050 fi
5151 fi
5252 fi
5353
54+ echo "Using Run ID: $RUN_ID"
5455 echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
55- echo "✅ Using Run ID: $RUN_ID"
5656
5757 - name : Download Artifacts
5858 id : download
@@ -63,57 +63,56 @@ jobs:
6363 mkdir -p artifacts
6464
6565 # Download semua artifacts dari build-grpc run
66- echo "📥 Downloading artifacts from run $RUN_ID..."
66+ echo "Downloading artifacts from run $RUN_ID..."
6767 gh run download "$RUN_ID" --dir artifacts
6868
6969 # List downloaded files
70- echo "📦 Downloaded files:"
70+ echo "Downloaded files:"
7171 find artifacts -type f -name "grpc.so" | head -20
7272
73- - name : Extract Version & Organize Artifacts
73+ - name : Extract Version and Organize Artifacts
7474 id : versions
7575 run : |
7676 # Ambil artifact directory pertama untuk extract versi
7777 ARTIFACT_DIR=$(find artifacts -type d -name "*grpc*" | head -1)
7878
7979 if [ -z "$ARTIFACT_DIR" ]; then
80- echo "❌ No artifact directory found!"
80+ echo "ERROR: No artifact directory found!"
8181 ls -la artifacts/
8282 exit 1
8383 fi
8484
85- echo "📂 Using artifact dir: $ARTIFACT_DIR"
85+ echo "Using artifact dir: $ARTIFACT_DIR"
8686
8787 # Parse nama: grpc-{arch}-ubuntu22.04-php{php_version}-v{grpc_version}
88- # Contoh: grpc-amd64-ubuntu22.04-php8.3-v1.80.0RC1
8988 BASENAME=$(basename "$ARTIFACT_DIR")
9089
9190 # Extract versions menggunakan regex
9291 if [[ $BASENAME =~ php([0-9.]+)-v(.+)$ ]]; then
9392 PHP_VERSION="${BASH_REMATCH[1]}"
9493 GRPC_VERSION="${BASH_REMATCH[2]}"
9594 else
96- echo "❌ Could not parse artifact name: $BASENAME"
95+ echo "ERROR: Could not parse artifact name: $BASENAME"
9796 exit 1
9897 fi
9998
10099 echo "PHP_VERSION=$PHP_VERSION" >> $GITHUB_OUTPUT
101100 echo "GRPC_VERSION=$GRPC_VERSION" >> $GITHUB_OUTPUT
102101
103- echo "✅ Extracted versions:"
104- echo " gRPC: $GRPC_VERSION"
105- echo " PHP: $PHP_VERSION"
102+ echo "Extracted versions:"
103+ echo " gRPC: $GRPC_VERSION"
104+ echo " PHP: $PHP_VERSION"
106105
107106 # Organize files ke artifacts root
108- echo "📝 Organizing artifacts..."
107+ echo "Organizing artifacts..."
109108 for arch_dir in artifacts/grpc-*-ubuntu*; do
110109 if [ -d "$arch_dir" ]; then
111110 if [[ $(basename "$arch_dir") == *"amd64"* ]]; then
112111 cp "$arch_dir/grpc.so" artifacts/grpc-amd64.so
113- echo " ✓ grpc-amd64.so"
112+ echo " Created: grpc-amd64.so"
114113 elif [[ $(basename "$arch_dir") == *"arm64"* ]]; then
115114 cp "$arch_dir/grpc.so" artifacts/grpc-arm64.so
116- echo " ✓ grpc-arm64.so"
115+ echo " Created: grpc-arm64.so"
117116 fi
118117 fi
119118 done
@@ -129,46 +128,40 @@ jobs:
129128
130129 # Check if release sudah ada
131130 if gh release view "$RELEASE_TAG" &>/dev/null; then
132- echo "⚠️ Release $RELEASE_TAG already exists, skipping..."
131+ echo "WARNING: Release $RELEASE_TAG already exists, skipping..."
133132 exit 0
134133 fi
135134
136- echo "🚀 Creating release: $RELEASE_TAG"
135+ echo "Creating release: $RELEASE_TAG"
137136
138137 # Create release dengan artifacts
139138 gh release create "$RELEASE_TAG" \
140139 --title "$RELEASE_NAME" \
141140 --notes "Pre-compiled gRPC extension for PHP ${PHP_VERSION}
142141
143- ** gRPC Version:** ${GRPC_VERSION}
144- ** PHP Version:** ${PHP_VERSION}
145- ** Built on:** Ubuntu 22.04
146- ** Architectures:** AMD64, ARM64
142+ gRPC Version : ${GRPC_VERSION}
143+ PHP Version : ${PHP_VERSION}
144+ Built on : Ubuntu 22.04
145+ Architectures : AMD64, ARM64
147146
148- # # 📥 Usage in Dockerfile
147+ Usage in Dockerfile :
148+
149+ FROM php:${PHP_VERSION}-fpm
149150
150- \`\`\`dockerfile
151- # Download and install gRPC
152151RUN curl -L -o /tmp/grpc.so \\
153152 https://github.com/${{ github.repository }}/releases/download/${RELEASE_TAG}/grpc-amd64.so && \\
154153 mv /tmp/grpc.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/grpc.so && \\
155- docker-php-ext-enable grpc
156- \`\`\`
157-
158- # # 📦 Available Downloads
159-
160- - **AMD64**: \`grpc-amd64.so\` - x86_64 architecture
161- - **ARM64**: \`grpc-arm64.so\` - ARM 64-bit architecture
162-
163- # # 📝 Download URLs
154+ docker-php-ext-enable grpc && \\
155+ rm -rf /tmp/*
164156
165- - AMD64 : \`https://github.com/${{ github.repository }}/releases/download/${RELEASE_TAG}/grpc-amd64.so\`
166- - ARM64 : \`https://github.com/${{ github.repository }}/releases/download/${RELEASE_TAG}/grpc-arm64.so\`
157+ Available Downloads :
158+ - grpc-amd64.so : https://github.com/${{ github.repository }}/releases/download/${RELEASE_TAG}/grpc-amd64.so
159+ - grpc-arm64.so : https://github.com/${{ github.repository }}/releases/download/${RELEASE_TAG}/grpc-arm64.so
167160" \
168161 artifacts/grpc-amd64.so \
169162 artifacts/grpc-arm64.so
170163
171- echo " ✅ Release $RELEASE_TAG created successfully!"
164+ echo " Release $RELEASE_TAG created successfully!"
172165
173166 - name : Print Release Summary
174167 env :
@@ -178,17 +171,16 @@ RUN curl -L -o /tmp/grpc.so \\
178171 RELEASE_TAG="v${GRPC_VERSION}-php${PHP_VERSION}"
179172
180173 echo ""
181- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ "
182- echo "✅ Release Published Successfully!"
183- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ "
174+ echo "======================================== "
175+ echo "Release Published Successfully!"
176+ echo "======================================== "
184177 echo ""
185- echo "📦 Release Tag: $RELEASE_TAG"
186- echo "🔗 Release URL:"
187- echo " https://github.com/${{ github.repository }}/releases/tag/$RELEASE_TAG"
178+ echo "Release Tag: $RELEASE_TAG"
179+ echo "Release URL: https://github.com/${{ github.repository }}/releases/tag/$RELEASE_TAG"
188180 echo ""
189- echo "📥 Download URLs:"
190- echo " AMD64: https://github.com/${{ github.repository }}/releases/download/$RELEASE_TAG/grpc-amd64.so"
191- echo " ARM64: https://github.com/${{ github.repository }}/releases/download/$RELEASE_TAG/grpc-arm64.so"
181+ echo "Download URLs:"
182+ echo " AMD64: https://github.com/${{ github.repository }}/releases/download/$RELEASE_TAG/grpc-amd64.so"
183+ echo " ARM64: https://github.com/${{ github.repository }}/releases/download/$RELEASE_TAG/grpc-arm64.so"
192184 echo ""
193- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ "
185+ echo "======================================== "
194186 echo ""
0 commit comments