Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Webpack Stat Reporter (packtracker.io)

2.2.1

Webpack Stat Reporter (packtracker.io)

upload-cloud

Webpack Stat Reporter (packtracker.io)

Report your webpack build stats to the packtracker.io service

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Webpack Stat Reporter (packtracker.io)

uses: packtracker/[email protected]

Learn more about this action in packtracker/report

Choose a version

Automated stat reporting for packtracker.io

Strategies to report your build stats via the following platforms

CircleCI Orb

Note: If you started using CircleCI prior to 2.1, you must enable pipelines within your project configuration to be able to use the orbs configuration.

Setup

The first step in adding our orb to your configuration is to declare it in your CircleCI configuration file.

version: 2.1

orbs:
  packtracker: packtracker/[email protected]

Authentication

In order for us to know what project you are reporting stats for, you must send along your packtracker project token. To do this with the CircleCI Orb, you must create a new project environment variable in your CircleCI settings called PT_PROJECT_TOKEN. You can find your packtracker project token in your project's settings.

Configuration

Now that you've declared our orb for use and added your project token, you have access to our report job. You can put this job anywhere inside your existing CircleCI workflows, or create a new workflow.

By default, this base configuration should just work most of the time. If you have a non-standard setup, you can tweak the job with the following 2 optional parameters.

version: 2.1

orbs:
  packtracker: packtracker/report@dev:2.2.0

workflows:
  packtracker:
    jobs:
      - packtracker/report
webpack_config

We try and assume your webpack configuration is located in the root of your repository as webpack.config.js

If it is not, you can let us know where it is like so.

workflows:
  packtracker:
    jobs:
      - packtracker/report:
          webpack_config: "./config/webpack/production.js"

For example, this is where the Ruby on Rails webpack configuration is located.

project_root

Sometimes you are trying to track a project within a greater repository, maybe the package.json does not live at the repository root, but in an internal directory. This is common for monorepo configurations like lerna.

workflows:
  packtracker:
    jobs:
      - packtracker/report:
          project_root: "./packages/internal_package"

GitHub Action

Secrets (Required)

Environment variables (Optional)

  • WEBPACK_CONFIG_PATH - the relative path to your webpack configuration (if you have one)
  • PT_PROJECT_ROOT - the relative path to the directory of your project (containing your package.json file)

Workflow

A sample workflow file might look something like this

workflow "packtracker.io" {
  on = "push"
  resolves = ["Report to packtracker.io"]
}

action "Report to packtracker.io" {
  uses = "packtracker/[email protected]"
  secrets = ["PT_PROJECT_TOKEN"]
  env = {
    "WEBPACK_CONFIG_PATH" = "./config/webpack/production.js"
    "PT_PROJECT_ROOT" = "./path/to/subdirectory"
  }
}