Skip to content
PolyPack
Docs: Installing in CI

Installing in CI

Install private Packs in GitHub Actions, GitLab CI or any other pipeline.

Use a Team Token in CI. It belongs to the Team, not a person, so pipelines keep working when someone leaves. Store it as a secret named POLYPACK_TOKEN. To install, it needs only read. To publish from GitHub Actions, use trusted publishing instead of a Token with publish; in other pipelines, give the Team Token publish.

Composer

GitHub Actions · a workflow job's step; store a Team Token as the secret POLYPACK_TOKEN (Settings → Secrets → Actions)
- run: composer install --no-interaction --prefer-dist
  env:
    COMPOSER_AUTH: '{"http-basic": {"hopper.pkg.polypack.io": {"username": "token", "password": "${{ secrets.POLYPACK_TOKEN }}"}}}'
GitLab CI · in .gitlab-ci.yml; store a Team Token as the secret POLYPACK_TOKEN as a masked CI/CD variable
install:
  image: composer:2
  script:
    - export COMPOSER_AUTH="{\"http-basic\": {\"hopper.pkg.polypack.io\": {\"username\": \"token\", \"password\": \"${POLYPACK_TOKEN}\"}}}"
    - composer install --no-interaction --prefer-dist
Any other CI · store a Team Token as the secret POLYPACK_TOKEN in the pipeline's environment
export COMPOSER_AUTH="{\"http-basic\": {\"hopper.pkg.polypack.io\": {\"username\": \"token\", \"password\": \"${POLYPACK_TOKEN}\"}}}"
composer install --no-interaction --prefer-dist

npm

GitHub Actions · a workflow job's steps; store a Team Token as the secret POLYPACK_TOKEN (Settings → Secrets → Actions); add npm publish with the same env to publish
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
  with:
    node-version: lts/*
    registry-url: https://hopper.pkg.polypack.io/npm/
    scope: '@hopper'
- run: npm ci
  env:
    NODE_AUTH_TOKEN: ${{ secrets.POLYPACK_TOKEN }}
GitLab CI · in .gitlab-ci.yml, with the project .npmrc committed; store a Team Token as the secret POLYPACK_TOKEN as a masked CI/CD variable
install:
  image: node:lts
  script:
    - npm config set //hopper.pkg.polypack.io/npm/:_authToken "${POLYPACK_TOKEN}"
    - npm ci
Any other CI · with the project .npmrc committed; store a Team Token as the secret POLYPACK_TOKEN in the pipeline's environment
npm config set //hopper.pkg.polypack.io/npm/:_authToken "$POLYPACK_TOKEN"
npm ci

Each Pack's page in PolyPack shows these lines for that Pack under CI.

Update bots: Renovate and Dependabot

Renovate and Dependabot need the same read-only Team Token to see new versions of your private Packs; without it they skip them, often without saying so. Store it as the bot's own secret POLYPACK_TOKEN, never in the file. Both read the npm scope from your project's committed .npmrc and the Composer repository from composer.json, which the install setup puts there. Keep only the registries you use.

Renovate · merge into renovate.json; add the Token as the encrypted secret POLYPACK_TOKEN in Renovate (the Mend app's settings, or `secrets` when self-hosted)
{
    "hostRules": [
        {
            "matchHost": "https://hopper.pkg.polypack.io/npm/",
            "hostType": "npm",
            "token": "{{ secrets.POLYPACK_TOKEN }}"
        },
        {
            "matchHost": "hopper.pkg.polypack.io",
            "hostType": "packagist",
            "username": "token",
            "password": "{{ secrets.POLYPACK_TOKEN }}"
        },
        {
            "matchHost": "https://hopper.pkg.polypack.io/rubygems/",
            "hostType": "rubygems",
            "username": "token",
            "password": "{{ secrets.POLYPACK_TOKEN }}"
        },
        {
            "matchHost": "hopper.cr.polypack.io",
            "hostType": "docker",
            "username": "token",
            "password": "{{ secrets.POLYPACK_TOKEN }}"
        }
    ]
}
Dependabot · in .github/dependabot.yml; add the Token as the Dependabot secret POLYPACK_TOKEN (Settings → Secrets → Dependabot, not Actions)
version: 2
registries:
  polypack-npm:
    type: npm-registry
    url: https://hopper.pkg.polypack.io/npm/
    token: ${{secrets.POLYPACK_TOKEN}}
  polypack-composer:
    type: composer-repository
    url: https://hopper.pkg.polypack.io/composer
    username: token
    password: ${{secrets.POLYPACK_TOKEN}}
  polypack-bundler:
    type: rubygems-server
    url: https://hopper.pkg.polypack.io/rubygems/
    token: ${{secrets.POLYPACK_TOKEN}}
  polypack-docker:
    type: docker-registry
    url: https://hopper.cr.polypack.io
    username: token
    password: ${{secrets.POLYPACK_TOKEN}}
updates:
  - package-ecosystem: npm
    directory: "/"
    registries: [polypack-npm]
    schedule:
      interval: weekly
  - package-ecosystem: composer
    directory: "/"
    registries: [polypack-composer]
    schedule:
      interval: weekly
  - package-ecosystem: bundler
    directory: "/"
    registries: [polypack-bundler]
    schedule:
      interval: weekly
  - package-ecosystem: docker
    directory: "/"
    registries: [polypack-docker]
    schedule:
      interval: weekly

A private Pack's page shows these under Update bots, and a Client's setup instructions include them for its Client Token.

To publish npm packages or push images from GitHub Actions, you need no stored Token at all: PolyPack's GitHub Action does it in one step, with trusted publishing.