Search code examples
phpgitgithubreleasepackagist

How to add new package version to Packagist?


I have a problem with adding a new package version to packagist.

https://github.com/skydriver/stripe-request https://packagist.org/packages/skydriver/stripe-request

My project is on Git Hub (with webhooks), and Dev version and the first release version was successfully added to packagist, but when I try to create new release, then it's not showing on packagist... here is my git log:

damjan@damjan-dev:~/www/projects/stripe/new-release$ git clone https://github.com/skydriver/stripe-request.git
Cloning into 'stripe-request'...
remote: Counting objects: 38, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 38 (delta 15), reused 21 (delta 5), pack-reused 0
Unpacking objects: 100% (38/38), done.
Checking connectivity... done.
...
damjan@damjan-dev:~/www/projects/stripe$ cd new-release/stripe-request/
damjan@damjan-dev:~/www/projects/stripe/new-release/stripe-request$ git add .
damjan@damjan-dev:~/www/projects/stripe/new-release/stripe-request$ git commit -m "New release"
[master fc9a023] New release
 1 file changed, 349 insertions(+)
 create mode 100644 StripeRequest.php
damjan@damjan-dev:~/www/projects/stripe/new-release/stripe-request$ git push origin master 
Username for 'https://github.com': SkyDriver
Password for 'https://[email protected]': 
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 2.42 KiB | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https://github.com/skydriver/stripe-request.git
   4ea2a02..fc9a023  master -> master
damjan@damjan-dev:~/www/projects/stripe/new-release/stripe-request$ git tag -a 1.0.2
damjan@damjan-dev:~/www/projects/stripe/new-release/stripe-request$ git push --tags 
Username for 'https://github.com': SkyDriver
Password for 'https://[email protected]': 
Counting objects: 1, done.
Writing objects: 100% (1/1), 175 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To https://github.com/skydriver/stripe-request.git
 * [new tag]         1.0.2 -> 1.0.2
damjan@damjan-dev:~/www/projects/stripe/new-release/stripe-request$ 

Can someone help me ?

Thanks.


Solution

  • It is all working fine! (almost)

    Your latest commit (when writing this answer) is fc9a023dcd03cf37f8a15b978d92eb40aa8b0de8. When I view dev-master version on Packagist I see the same commit hash. All is good here.

    Except for one thing! You've specified the version field in your composer.json. Remove it! This is why you're stuck on 1.0.0.

    Versions like 1.0.0 on Packagist correspond with tags on Github. Simply tag a commit and push it (git push --tags). Soon this version is known in Packagist.

    PS: Packagist has some lag sometimes, can be a couple of minutes. Have some patience :)

    The fact that the commit hash of dev-master corresponds with the latest on Github proves the hook is working.

    PPS: Run composer.phar validate and fix everything it complains about.

    PPPS: You haven't added the composer.lock file to git. This can (in this case) be seen as a good thing! Since it's a library, and when you enable CI to it, the CI will use the newest versions of dependencies, which can warn you of future incompatibilities. But whenever a project is not meant as a dependency for something else, always add te lock file.