Skip to content

Commit 22bd57b

Browse files
committed
Trusted publishing: add docs
1 parent 9f94b13 commit 22bd57b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,21 @@ From `$client` object, you can access the full Private Packagist API.
169169

170170
Full documentation can be found in the [Private Packagist documentation](https://packagist.com/docs/api).
171171

172+
### Trusted publishing
173+
174+
To upload artifact files, trusted publishing can be used in certain environment like GitHub Actions without the need to
175+
configure authentication via API key and secret.
176+
177+
```php
178+
$fileName = 'package1.zip';
179+
$file = file_get_contents($fileName);
180+
$client = new \PrivatePackagist\ApiClient\Client();
181+
$client->authenticateWithTrustedPublishing('acme-org', 'acme/package');
182+
$client->packages()->artifacts()->add('acme/package', $file, 'application/zip', $fileName);
183+
```
184+
185+
We recommend using the [GitHub action](https://github.com/packagist/artifact-publish-github-action) directly.
186+
172187
### Organization
173188

174189
#### Trigger a full synchronization

0 commit comments

Comments
 (0)