diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dba05fc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: publish + +permissions: + contents: read + +on: + release: + types: [published] + +jobs: + packagist: + name: Publish Package to Packagist + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Trigger Packagist Update + env: + PACKAGIST_USERNAME: ${{ secrets.PACKAGIST_USERNAME }} + PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }} + run: | + curl -X POST https://packagist.org/api/update-package?username=${PACKAGIST_USERNAME}&apiToken=${PACKAGIST_TOKEN} \ + -H "Content-Type: application/json" \ + -d "{\"repository\":{\"url\":\"${{ github.event.repository.clone_url }}\"}}"