Skip to content

v1.1.1

v1.1.1 #6

Workflow file for this run

name: Release Package
on:
release:
types: [published]
jobs:
submit-to-packagist:
runs-on: ubuntu-latest
name: Submit to Packagist
steps:
- name: Submit package to Packagist
env:
PACKAGIST_USERNAME: ${{ secrets.PACKAGIST_USERNAME }}
PACKAGIST_API_TOKEN: ${{ secrets.PACKAGIST_API_TOKEN }}
REPOSITORY_URL: https://github.com/${{ github.repository }}
run: |
response=$(curl -s -w "HTTPSTATUS:%{http_code}" -XPOST \
-H'content-type:application/json' \
"https://packagist.org/api/update-package?username=${PACKAGIST_USERNAME}&apiToken=${PACKAGIST_API_TOKEN}" \
-d"{\"repository\":{\"url\":\"${REPOSITORY_URL}\"}}")
http_code=$(echo $response | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
body=$(echo $response | sed -e 's/HTTPSTATUS\:.*//g')
if [ "$http_code" -eq 200 ] || [ "$http_code" -eq 202 ]; then
echo "Package submitted to Packagist successfully!"
echo "HTTP Status: $http_code"
else
echo "Failed to submit package to Packagist"
echo "HTTP Status: $http_code"
echo "Response: $body"
exit 1
fi