user2468946
user2468946

Reputation: 31

How can I publish stable version with composer

How can I publish stable version? For example, developers of Yii2 framework have stable versions on composer, but in their repository I can't find matches with their branches on repository. How do they publish stable versions? when I publish my work on packagist.org they allow me only insert my repository url

Upvotes: 0

Views: 1826

Answers (2)

Sven
Sven

Reputation: 70933

The simplest way is to use a tag in your repository. Note that this works for all supported repositories, i.e. Git, Mercurial and Subversion.

The tag name must be a valid version number according to the spec, which is documented on the http://semver.org website - this applies even if you don't want to follow semantic versioning. Composer details are in the documentation: https://getcomposer.org/doc/01-basic-usage.md#package-versions and https://getcomposer.org/doc/04-schema.md#version (note that you do NOT add a version into the composer.json file when using a repository that supports tagging!).

So to release a version 1.0, you tag the commit you want it to be with any of these names

  • v1.0
  • 1.0
  • v1.0.0
  • 1.0.0

I recommend using the last one. That "v" character isn't really needed, and always using three numbers is the best way to avoid having two tags, one "1.0" and one "1.0.0" pointing to different commits, but representing the same version.

Once you push the tag to the public repository hoster (or transfer that tag to the repository when not using Git), Packagist will see it and create everything needed to inform the world about this released version.

Anything fancy, like sending release mails to a mailing list, is up to you. The Composer part of a release really is: simply create a tag with a name that is recognized as a version number, and make it public.

Upvotes: 1

arogachev
arogachev

Reputation: 33548

In your GitHub repository go to Releases tab, then Draft a new release.

At any commit you can create draft and use it later or release new version right away.

Additionally you can mark release as pre-release.

Synchronization with Packagist is automatic (note that you need create hook, how to do it is explained here).

Useful docs:

Upvotes: 2

Related Questions