MeteorGPLby WebbingApps

Composer in CI

A limited token for your pipeline, COMPOSER_AUTH, and recipes for GitHub Actions and GitLab CI.

On this page
  1. Before you start
  2. Hand the token to Composer
  3. GitHub Actions
  4. GitLab CI
  5. Report what the pipeline installed
  6. Caching
  7. Deploy on new versions
  8. Questions

Before you start

Hand the token to Composer

Composer reads credentials from the COMPOSER_AUTH environment variable, so nothing is written to disk:

COMPOSER_AUTH='{"http-basic":{"composer.meteorgpl.com":{"username":"token","password":"<your-token>"}}}'

GitHub Actions

- name: Install PHP dependencies
  env:
    COMPOSER_AUTH: '{"http-basic":{"composer.meteorgpl.com":{"username":"token","password":"${{ secrets.METEORGPL_TOKEN }}"}}}'
  run: composer install --no-interaction --prefer-dist

GitLab CI

install:
  image: composer:2
  variables:
    COMPOSER_AUTH: '{"http-basic":{"composer.meteorgpl.com":{"username":"token","password":"$METEORGPL_TOKEN"}}}'
  script:
    - composer install --no-interaction --prefer-dist

The CI page of the documentation has the same for Bitbucket Pipelines and CircleCI, and the step that reports composer.lock to a project.

The Continuous integration documentation page with the recipes for GitHub Actions and the other CI services.
Documentation → Continuous integration: a recipe per CI service.

Report what the pipeline installed

After composer install, a step can send composer.lock to a project, which then shows which packages are behind:

curl -fsS -u token:$METEORGPL_TOKEN -F lock_file=@composer.lock https://meteorgpl.com/api/projects/<project-id>/lock

The project page shows this command with its own id.

Caching

Versions never change once published: cache Composer's cache directory between runs, and commit composer.lock. Installs stay reproducible until a version is withdrawn.

Deploy on new versions

A webhook can start a pipeline when a package you use gets a new version, for example a GitHub repository_dispatch that runs composer update and opens a pull request.

Questions

My pipeline gets 403. The account or organisation has no active plan, or the runner's address is outside the networks the token allows. Check Settings → Composer tokens and the runner's outgoing IP address.

Did this not answer your question? Contact support.

Send feedback

What works, what does not, what is missing: a few words help.

Only if you would like a reply.

Taken in your browser, without this window. Passwords, what you typed into forms, keys and tokens are left out as grey blocks; you can hide more before sending. We keep screenshots for 90 days.

We store it with the page address, your language, window size, browser and IP address, and your e-mail address if you give one. The IP address and browser are deleted after 90 days. Privacy policy.

All languages