elendev / nexus-composer-push
Requires
- php: >=7.2 || ^8.0
- composer-plugin-api: ^1.1|^2.0
- ext-curl: *
- ext-json: *
- ext-zip: *
- guzzlehttp/guzzle: ^6.0|^7.0
- symfony/filesystem: ^4.0|^5.0|^6.0
- symfony/finder: ^4.0|^5.0|^6.0
Requires (Dev)
- composer/composer: ^1.8 || ^2.0
- friendsofphp/php-cs-fixer: ^2.18|^3.4.0
- phpunit/phpunit: ^8 || ^9 || ^10
Suggests
- elendev/composer-push: Replaces the elendev/nexus-composer-push repository, which is deprecated.
Replaces
- dev-master
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.7
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- v0.1.0
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1-alpha3
- v0.0.1-alpha
- dev-dependabot/composer/phpunit/phpunit-tw-11.3.4
- dev-dependabot/composer/phpunit/phpunit-tw-11.3.3
- dev-dependabot/composer/symfony/finder-tw-7.1.4
- dev-support-symfony7-composer27-php82
- dev-dependabot/composer/symfony/filesystem-tw-7.1.2
- dev-dependabot/composer/friendsofphp/php-cs-fixer-tw-3.0
- dev-firstTests
This package is auto-updated.
Last update: 2024-09-10 04:29:23 UTC
README
此composer插件提供了一个composer push
命令,允许将当前包推送到远程composer仓库。
当前支持的仓库包括
安装
$ composer require elendev/composer-push
重要提示
此插件是elendev/nexus-composer-push
的延续,如果您还没有迁移,则需要迁移到这个版本。
使用方法
许多选项都是可选的,因为它们可以直接添加到composer.json
文件中。
# At the root of your directory $ composer push [--name=<package name>] \ [--url=<URL to the composer repository>] \ [--type=<Type of repository, nexus by default, artifactory available too>] [--repository=<the repository you want to save, use this parameter if you want to control which repository to upload to by command-line parameter>] \ [--username=USERNAME] \ [--password=PASSWORD] \ [--ignore=test.php]\ [--ignore=foo/]\ [--ignore-by-git-attributes]\ [--src-type=<The type of repository used for source code: git, svn, ... which will be added to source tag of composer package>]\ [--src-url=<URL of the source code repository which will be added to source tag of composer package>]\ [--src-ref=<The reference to the current code version for this package which will be added to source tag of composer package>]\ [--keep-vendor, Keep vendor directory when creating zip]\ [--ssl-verify=true/]\ [--access-token=<ACCESS_TOKEN added in Bearer>] <version> If <version> is not set, `composer.json` version will be used. # Example $ composer push --username=admin --password=admin123 --url=https://:8081/repository/composer --ignore=test.php --ignore=foo/ --src-type=git --src-url="$(git remote get-url origin)" --src-ref="$(git rev-parse HEAD)" 0.0.1 # Example of use --repository # you need firstly configure multi repositories in composer.json of the project. # Please refer to Configuration below (multi repository configuration format) for configuration method # The component will be uploaded to the first repository whose's name value matching -- repository value # If there is no matching between the value of repository name and the value of -- repository, the upload will fail with a prompt $ composer push --username=admin --password=admin123 --repository=prod --ignore=test.php --ignore=foo/ 0.0.1
配置
可以在composer.json
文件中添加一些配置
{ "extra": { "push": { "url": "https://:8081/repository/composer", "type": "nexus", "ssl-verify": true, "username": "admin", "password": "admin123", "ignore-by-git-attributes": true, "ignore": [ "test.php", "foo/" ] } } }
上述配置可以称为唯一仓库配置格式,因为在composer.json中您只能配置一个仓库。
在实际应用中,出于安全考虑,不同版本的组件代码,如生产版和开发版,通常应用不同的部署策略,如禁用生产版的重部署,允许开发版的重部署,因此需要存储在不同的仓库中。对于0.1.5之后的版本,引入了命令行参数--repository以满足这一需求。要启用--repository参数,composer.json文件需要以下格式
{ "extra": { "push": [{ "name": "prod", "type": "artifactory", "url": "https://jfrog-art.com/artifactory/composer-local/", "username": "admin", "password": "admin123", "ignore-by-git-attributes": true, "ignore": [ "test.php", "foo/" ] }, { "name": "dev", "url": "https://:8081/repository/composer-devs", "username": "admin", "password": "admin123", "ignore-by-git-attributes": true, "ignore": [ "test.php", "foo/" ] }] } }
上述配置可以称为多仓库配置格式。
新版本继续支持解析唯一仓库配置格式,但请记住,在这种情况下不能使用--repository命令行参数。
username
和password
可以通过Composer提供的认证机制在auth.json
文件中以用户为单位指定。
提供者
某些提供者的特定性。
Nexus
源类型、URL、参考
这是可以添加到composer.json文件中的可选部分,可以包含此版本的源引用。此选项在您有源管理器且希望直接链接到特定版本的源时非常有用。上述示例将读取git的最后提交ID和远程地址,这相当简单且有用。
Artifactory
令牌
令牌目前支持作为密码使用。仍需要用户名才能使其工作。
目前不支持独立令牌。
令牌使用示例
{ "extra": { "push": { "url": "https://jfrog-art.com/artifactory/composer-local", "type": "artifactory", "username": "<username>", "password": "<Authentication token for the user username>" } } }