fastly / fastly-php

A Fastly API client for PHP
https://packagist.org/packages/fastly/fastly
MIT License
24 stars 34 forks source link

CI to automatically publish to Packagist #44

Closed harmony7 closed 1 year ago

harmony7 commented 1 year ago

This PR adds a publish mechanism to allow this API client to publish itself to Packagist and create a release in GitHub.

The input is to create a tag in this repo and push it, with the syntax: release/[VERSION][-dry].

This CI is intended to be used along with the client generator project, whose job it is to generate the newest API client code, tag it with said version code, and push it to this repo.

Unless running in -dry mode, this CI step will create a real version in Packagist, and a release in GitHub. Example run using release/v1.0.1-alpha0 has generated the following:

If running in -dry mode, no actual Packagist publish or release will be made. Example run using release/v1.0.1-alpha0-dry:

This CI relies on Packagist's ability to "auto-update" from tags in the repo. Therefore this CI uses the release/<VERSION> syntax as input, but creates its own tag that looks like v<VERSION>. Packagist is notified of new tags via a Webhook, and creates a version by crawling it.