Skip to content

Commit 5f13d46

Browse files
committed
Switch to workflow artifacts for PECL release
1 parent b5b39e5 commit 5f13d46

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

.github/workflows/pecl.yml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,48 +94,54 @@ jobs:
9494
auto-detect-libs: true
9595
no-debug-symbols-ddtrace: true
9696

97-
artifacts:
97+
artifact:
9898
runs-on: ubuntu-latest
9999
needs: extension
100+
outputs:
101+
artifact-id: ${{ steps.artifact.outputs.artifact-id }}
100102
steps:
101-
- name: Upload artifacts
103+
- name: Upload artifact
102104
uses: actions/upload-artifact/merge@v5
105+
id: merge
103106
with:
104-
name: artifacts
107+
name: artifact
105108
delete-merged: true
106109

107-
pecl-release:
108-
runs-on: ubuntu-latest
109-
needs: artifacts
110-
steps:
111-
- name: Get artifact
110+
- name: Get merged artifact
112111
uses: actions/download-artifact@v5
113112
with:
114-
name: artifacts
115-
path: artifacts
116-
- name: Release
113+
name: artifact
114+
path: artifact
115+
116+
- name: Remove merged artifact
117117
env:
118118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
run: gh api --method DELETE "repos/${{ github.repository }}/actions/artifacts/${{ steps.merge.outputs.artifact-id }}"
120+
121+
- name: Stage artifact for release
122+
id: stage
119123
run: |
120-
ls -l artifacts
121124
extension=$(basename "${{ inputs.extension-url }}" | tr '[:upper:]' '[:lower:]')
122-
mkdir -p /tmp/$extension/${{ inputs.extension-ref }}/
123-
cp -a artifacts/* /tmp/$extension/${{ inputs.extension-ref }}/
124-
cd /tmp || exit 1
125-
zip -r $extension-${{ inputs.extension-ref }}.zip $extension
126-
if ! gh release view pecl -R ${{ github.repository }}; then
127-
gh release create pecl $extension-${{ inputs.extension-ref }}.zip -t pecl -n pecl -R ${{ github.repository }}
128-
else
129-
gh release upload pecl $extension-${{ inputs.extension-ref }}.zip -R ${{ github.repository }} --clobber
130-
fi
125+
mkdir -p /tmp/$extension/$extension/${{ inputs.extension-ref }}/
126+
cp -a artifact/* /tmp/$extension/$extension/${{ inputs.extension-ref }}/
127+
echo "artifact-name=$extension-${{ inputs.extension-ref }}" >> "$GITHUB_OUTPUT"
128+
echo "artifact-path=/tmp/$extension" >> "$GITHUB_OUTPUT"
129+
130+
- name: Upload zip
131+
uses: actions/upload-artifact@v5
132+
id: artifact
133+
with:
134+
name: ${{ steps.stage.outputs.artifact-name }}
135+
path: ${{ steps.stage.outputs.artifact-path }}
136+
131137
upload:
132138
runs-on: ubuntu-latest
133-
needs: pecl-release
139+
needs: artifact
134140
steps:
135141
- name: Upload to downloads server
136142
run: |
137143
extension=$(basename "${{ inputs.extension-url }}")
138-
url="https://github.com/${{ github.repository }}/releases/download/pecl/$extension-${{ inputs.extension-ref }}.zip"
144+
url="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.artifact.outputs.artifact-id }}/zip"
139145
gh workflow run pecl.yml -R php/web-downloads -f url="$url" -f extension="$extension" -f ref="${{ inputs.extension-ref }}"
140146
env:
141147
GITHUB_TOKEN: ${{ secrets.WINDOWS_BUILDS_TOKEN }}

0 commit comments

Comments
 (0)