1. Resources
  2. /
  3. Plugins
  4. /
  5. publish-to-packages-buildkite-plugin

Publish to Packages Build status

A Buildkite plugin that publishes build artifacts and attestations to Buildkite Packages.

This plugin authenticates with Buildkite Packages using an Agent OIDC token, so your registry needs to be configured with a suitable OIDC policy.

Quick Start

Minimal

steps:
  - label: "Publish Gem"
    plugins:
      - publish-to-packages#v2.2.0:
          artifacts: "awesome-logger-*.gem"
          registry: "acme-corp/awesome-logger"

The Works

steps:
  - label: "Publish Gem"
    plugins:
      - publish-to-packages#v2.2.0:
          artifacts: "awesome-logger-*.gem"
          registry: "acme-corp/awesome-logger"
          attestations: # optional
            - "gem-build.attestation.json"
            - "gem-package.attestation.json"
          artifact_build_id: "${BUILDKITE_TRIGGERED_FROM_BUILD_ID}" # optional

Options

artifacts (string, required)

A glob pattern for artifacts to publish to Buildkite Packages from Build artifacts.

registry (string, required)

Buildkite Packages registry to publish to.

  • Full format is <organization>/<registry_name> (e.g. acme-corp/awesome-logger).
  • <organization> defaults to your Buildkite organization if omitted (e.g. awesome-logger).

attestations (string or array of strings, optional)

One or more attestations from artifact storage to publish along with each package created from artifacts.

Each attestation file must be a valid JSON object. You can use Generate Provenance Attestation plugin to generate a valid SLSA Provenance attestation in your Buildkite pipeline.

If artifact_build_id is specified, attestations will be downloaded from the relevant build artifact storage.

artifact_build_id (string, optional)

Configures the plugin to download artifacts from a different build, referenced by its UUID.

When this option is not specified, the plugin defaults to downloading artifacts from the build that it is running in.

This is typically used when package building and package publishing are split across two different pipelines and the former triggers the latter. See Building and publishing from different pipelines example below.

Usage

Building and publishing from the same pipeline

Build Gem step builds and uploads awesome-logger-*.gem package to the build artifact storage.

Publish Gem step uses Publish to Packages to publish the package from the build artifact storage to acme-corp/awesome-logger Packages registry.

Globbing (awesome-logger-*.gem) is a good way to accommodate version changes/increments (e.g. awesome-logger-1.0.5.gem).

steps:
  - label: "Build Gem"
    key: "build-gem"
    command: "gem build awesome-logger.gemspec"
    artifact_paths: "awesome-logger-*.gem" # upload to build artifact storage

  - label: "Publish Gem"
    depends_on: "build-gem"
    plugins:
      - publish-to-packages#v2.2.0:
          artifacts: "awesome-logger-*.gem" # publish from build artifact storage
          registry: "acme-corp/awesome-logger"

Building and publishing from different pipelines

There are two pipelines in this example:

  1. Build Package pipeline
  2. Publish Package pipeline

Build Package pipeline builds a gem, uploads it to its artifact storage and triggers the Publish Package pipeline to publish the package.

In Publish Packages pipeline, the artifact_build_id option is specified to reference the build that triggered it. This configures the plugin to download artifacts from the Build Package build that triggered it.

# build.pipeline.yml

steps:
  - label: "Build Gem"
    key: "build-gem"
    command: "gem build awesome-logger.gemspec"
    artifact_paths: "awesome-logger-*.gem" # upload to build artifact storage

  - label: "Trigger Publish pipeline"
    depends_on: "build-gem"
    trigger: "publish-package-pipeline"
    branches: "${BUILDKITE_BRANCH}"
    build:
      commit: "${BUILDKITE_COMMIT}"
      branch: "${BUILDKITE_BRANCH}"
# publish.pipeline.yml

steps:
  - label: "Publish Gem"
    plugins:
      - publish-to-packages#v2.2.0:
          artifacts: "awesome-logger-*.gem"
          registry: "acme-corp/awesome-logger"
          artifact_build_id: "${BUILDKITE_TRIGGERED_FROM_BUILD_ID}"

Building and publishing with a provenance attestation

steps:
  - label: "Build Gem"
    key: "build-gem"
    command: "gem build awesome-logger.gemspec"
    artifact_paths: "awesome-logger-*.gem" # upload to build artifact storage
    plugins:
      - generate-provenance-attestation#v1.0.0:
          artifacts: "awesome-logger-*.gem" # publish from build artifact storage
          attestation_name: "gem-build.attestation.json"

  - label: "Publish Gem"
    depends_on: "build-gem"
    plugins:
      - publish-to-packages#v2.2.0:
          artifacts: "awesome-logger-*.gem" # publish from build artifact storage
          registry: "acme-corp/awesome-logger"
          attestations: "gem-build.attestation.json"

The plugins listed on this webpage are provided for informational purposes only. They have not undergone any formal security review or assessment. While we strive to provide useful resources, we cannot guarantee the safety, reliability, or integrity of these plugins. Users are strongly advised to conduct their own security evaluations before downloading, installing, or using any plugin. By using these plugins, you acknowledge and accept any risks associated with their use. We disclaim any liability for any harm or damages arising from the use of the plugins listed.

Start turning complexity into an advantage

Create an account to get started with a 30-day free trial. No credit card required.

Buildkite Pipelines

Platform

  1. Pipelines
  2. Pipeline templates
  3. Public pipelines
  4. Test Engine
  5. Package Registries
  6. Mobile Delivery Cloud
  7. Pricing

Hosting options

  1. Self-hosted agents
  2. Mac hosted agents
  3. Linux hosted agents

Resources

  1. Docs
  2. Blog
  3. Changelog
  4. Webinars
  5. Plugins
  6. Case studies
  7. Events
  8. Migration Services
  9. Comparisons

Company

  1. About
  2. Careers
  3. Press
  4. Brand assets
  5. Contact

Solutions

  1. Replace Jenkins
  2. Workflows for AI/ML
  3. Testing at scale
  4. Monorepo mojo
  5. Bazel orchestration

Legal

  1. Terms of Service
  2. Acceptable Use Policy
  3. Privacy Policy
  4. Subprocessors
  5. Service Level Agreement

Support

  1. System status
  2. Forum
© Buildkite Pty Ltd 2025