Continuous integration
Store a token as a secret, hand it to Composer through COMPOSER_AUTH, and optionally report the lock file to your dependency dashboard.
1. A token for CI
Create it under Settings → Composer tokens (or, for a team, the organisation's Composer tokens: it keeps working when people leave). Limit it to the packages the project uses and to your runners' IP ranges, and give it an expiry date. Save it as a secret named METEORGPL_TOKEN.
The repository goes in the project's composer.json once:
composer config repositories.meteorgpl composer https://composer.meteorgpl.com
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
- name: Report composer.lock to the dependency dashboard
if: github.ref == 'refs/heads/main'
run: curl -fsS -u "token:${{ secrets.METEORGPL_TOKEN }}" -F lock_file=@composer.lock https://meteorgpl.com/api/projects/<project-id>/lock
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
Bitbucket Pipelines
- step:
image: composer:2
script:
- export COMPOSER_AUTH='{"http-basic":{"composer.meteorgpl.com":{"username":"token","password":"'"$METEORGPL_TOKEN"'"}}}'
- composer install --no-interaction --prefer-dist
CircleCI
- run:
name: composer install
command: |
export COMPOSER_AUTH='{"http-basic":{"composer.meteorgpl.com":{"username":"token","password":"'"$METEORGPL_TOKEN"'"}}}'
composer install --no-interaction --prefer-dist
Caching and reproducible builds
Dists are immutable: cache Composer's cache directory between runs (composer config cache-dir). Commit composer.lock; every published version stays available, so installs are reproducible until a version is withdrawn.
Deploy on new versions
A webhook (Settings → Webhooks) can trigger a workflow when a package you use gets a new version — for example a repository_dispatch that runs composer update and opens a pull request.