Getting Started with Bricks Action

Bricks Action makes Bricks CLI accessible through GitHub Actions, allowing DevOps teams to run any Bricks CLI command directly within their workflows. It seamlessly automates tasks such as:

  • Version bumping (bricks bp bump)

  • Blueprint and Artifact updates and publishing (bricks bp update)

  • Blueprint installation and uninstall (bricks install/uninstall)

For the full list of available bricks CLI commands, please see the bricks CLI Commands Reference.

By integrating Bricks Action, teams can streamline CI/CD processes, ensuring efficient, automated, and scalable infrastructure management.

Getting Started

Integrate bricks CLI with your GitHub CI/CD by following the instructions in the bricks-action repository on GitHub 🔗 https://github.com/bluebricks-co/bricks-action

Prerequisites

  1. Bricks API Key

    • Requirement: A valid Bluebricks Long-Lived Token (API key) is required to authenticate with the bricks service and perform version bumps, blueprint updates, and publishing operations.

    • How to Generate: Follow the steps outlined in the official Bluebricks documentation.

    • Tip: Store your API key securely in your GitHub repository secrets as BRICKS_API_KEY.

  2. GitHub Token

    • Requirement: The action leverages GitHub's built-in GITHUB_TOKEN to perform Git operations such as commits and pushes.

    • Setup: Ensure that your workflow has the necessary permissions (e.g., contents: write, pull-requests: write).

  3. Repository Organization

    • Structure your repository with designated directories for artifacts and blueprints (e.g., bluebricks/artifacts and bluebricks/blueprints).

    • Prepare a Bricks configuration file (e.g., config-dev.yaml) with your project-specific settings.

Usages

Bricks Action does not include built-in workflows and must be implemented based on specific use-case requirements. Below is an example of how to integrate Bricks Action within a GitHub Actions workflow:

name: 'Update Artifacts and Blueprints'

on:
  pull_request:
    types: [opened, synchronize, reopened]
  pull_request_review:
    types: [submitted]

permissions:
  id-token: write
  contents: write
  pull-requests: write

jobs:
  updateci:
    runs-on: ubuntu-latest
    if: |
      (github.event_name == 'pull_request') ||
      (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')

    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          persist-credentials: false
          ref: ${{ github.event.pull_request.head.ref }} # This is the PR branch

      - name: Run updateci Command
        uses: bluebricks-co/bricks-action@main
        with:
          command: 'updateci'
          artifacts-folder: 'bluebricks/packages'
          blueprints-folder: 'bluebricks/blueprints'
          artifact-bump: 'patch'
          blueprint-bump: 'patch'
          base: 'origin/master'
          api-key: ${{ secrets.BRICKS_API_KEY }}
          config-file: ${{ github.workspace }}/config-dev.yaml
          flags: ${{ github.event_name == 'pull_request' && '--dry' || '' }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Next Steps

Last updated

Was this helpful?