Skip to content

Commit b2e2385

Browse files
authored
Update pecl.yml
1 parent e1196b3 commit b2e2385

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

.github/workflows/pecl.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
strategy:
9797
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
9898
steps:
99-
- name: Create PECL release
99+
- name: Create or Update PECL Release
100100
env:
101101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102102
run: |
@@ -105,43 +105,43 @@ jobs:
105105
arch="${{ matrix.arch }}"
106106
ts="${{ matrix.ts }}"
107107
ref="${{ inputs.extension-ref }}"
108-
109-
# Determine VS version based on PHP version
108+
110109
case "$php_version" in
111110
7.2|7.3|7.4) vs_version="vc15" ;;
112111
8.0|8.1|8.2|8.3) vs_version="vs16" ;;
113112
8.4|8.5) vs_version="vs17" ;;
114-
*) vs_version="vs16" ;; # default fallback
113+
*) vs_version="vs16" ;; # fallback
115114
esac
116115
117-
# Artifact name matches what's created in extension job (with .zip extension)
118116
artifact_name="php_${extension}-${ref}-${php_version}-${ts}-${vs_version}-${arch}.zip"
119-
120-
# Get artifact ID and download as zip
121-
artifact_id=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq ".artifacts[] | select(.name==\"${artifact_name}\") | .id")
122-
117+
release_tag="${extension}-${ref}"
118+
119+
artifact_id=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \
120+
--jq ".artifacts[] | select(.name==\"${artifact_name}\") | .id")
121+
123122
if [ -z "$artifact_id" ]; then
124123
echo "Artifact ${artifact_name} not found"
125124
exit 1
126125
fi
127-
128-
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
126+
127+
curl -L \
128+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
129129
-H "Accept: application/vnd.github.v3+json" \
130130
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${artifact_id}/zip" \
131-
-o "artifact_wrapper.zip"
131+
-o artifact_wrapper.zip
132132
133-
unzip "artifact_wrapper.zip"
134-
135-
# Release by extension version
136-
release_tag="${extension}-${ref}"
137-
138-
# Create or update release
139-
if ! gh release view "${release_tag}" -R ${{ github.repository }}; then
140-
gh release create "${release_tag}" "${artifact_name}" \
133+
New-Item -Path ".\$artifact_id" -ItemType Directory -Force | Out-Null
134+
unzip -oq artifact_wrapper.zip -d "./$artifact_id"
135+
136+
if ! gh release view "${release_tag}" -R ${{ github.repository }} >/dev/null 2>&1; then
137+
if ! gh release create "${release_tag}" ./$artifact_id/php-* \
141138
-t "${extension} ${ref}" \
142139
-n "Release of PECL extension '${extension}' version ${ref}" \
143-
-R ${{ github.repository }}
140+
-R ${{ github.repository }}; then
141+
gh release upload "${release_tag}" ./$artifact_id/php-* \
142+
-R ${{ github.repository }} --clobber
143+
fi
144144
else
145-
gh release upload "${release_tag}" "${artifact_name}" \
145+
gh release upload "${release_tag}" ./$artifact_id/php-* \
146146
-R ${{ github.repository }} --clobber
147147
fi

0 commit comments

Comments
 (0)