GitHub Action to publish artifacts as package versions to Private Packagist.
PHP and Composer are required but will automatically be set up using the Setup PHP GitHub Action if not available.
Supported are PHP >= 7.2 and Composer >= 2.
The GitHub Action can then be used as a step within a job e.g. on tag push. Create your artifact file before the publish artifact step.
jobs:
publish_artifact:
name: Private Packagist Publish Artifact
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
# Create your artifact file here
- name: "Publish artifact"
uses: packagist/publish-artifact-github-action
with:
package_name: 'acme/package'
organization_url_name: 'acme-org'
artifact: '/full/path/to/artifact.zip'
env:
PRIVATE_PACKAGIST_API_KEY: ${{ secrets.PRIVATE_PACKAGIST_API_KEY }}
PRIVATE_PACKAGIST_API_SECRET: ${{ secrets.PRIVATE_PACKAGIST_API_SECRET }}
The package_name
input parameter allows you to configure the name of the package you would like to publish. Note: the name has to match the name that is set in the composer.json file in the artifact.
For example:
- uses: packagist/publish-artifact-github-action
with:
package_name: "acme/package"
The organization_url_name
input parameter allows you to configure the Private Packagist organization where you want to publish the package to. The parameter is currently only used when using the trusted publishing flow but must be set either way.
For example:
- uses: packagist/publish-artifact-github-action
with:
organization_url_name: "acme/org"
The artifact
input parameter allows you to configure which artifact you would like to publish to Private Packagist. The value need to include the full path.
For example:
- uses: packagist/publish-artifact-github-action
with:
artifact: '/full/path/to/artifact.zip'
The private_packagist_url
input parameter allows you to configure the URL of your Private Packagist host. Useful if you are running Private Packagist Self-Hosted.
For example:
- uses: packagist/publish-artifact-github-action
with:
private_packagist_url: 'https://private-packagist-self-hosted.example'
The GitHub Action is licensed under the MIT License.