Publish GHA deployed artifacts

2 minute read

Register deployed artifact metadata from your GitHub Actions workflow to CloudBees Unify to track artifact deployments across environments. Use deployment data to enable DORA metrics, environment inventory tracking, and deployment analytics for artifacts deployed through GHA workflows.

This action is available on the GitHub Marketplace.

This action uses GitHub OIDC authentication to securely communicate with CloudBees Unify. Be sure to set permissions to id-token: write in your workflow.

For more information about working with artifacts in CloudBees Unify, refer to Manage workflow artifacts.

Inputs

Table 1. Input details
Input name Data type Required? Description

cloudbees-url

String

No

URL of the CloudBees Unify API. Defaults to https://api.cloudbees.io.

target-environment

String

Yes

Deployment environment. You must create the environment in CloudBees Unify before using it in this action.

labels

String

No

Comma-separated labels for this deployment.

artifact-id

String

No

ID of the artifact, generated by the register-build-artifact action. Either this or artifact-url must be present.

artifact-url

String

No

URL of the deployed artifact. Either this or artifact-id must be present.

Outputs

This action produces no output.

Usage examples

The following is a basic example of using the action:

permissions: id-token: write contents: read steps: - name: register-deployment-step uses: cloudbees-io-gha/register-deployed-artifact@v1 with: target-environment: pre-prod labels: v1.0.0, rc1 artifact-id: 87ace777-ab20-4867-ac3f-ad5c28f46a29

The following example uses the artifact URL instead of the artifact ID:

permissions: id-token: write contents: read steps: - name: register-deployment-step uses: cloudbees-io-gha/register-deployed-artifact@v1 with: target-environment: production artifact-url: https://hub.docker.com/repository/docker/example

Full workflow and run example

Running this workflow creates an artifact that is reported to CloudBees Unify, and then that artifact is deployed.

Example GHA workflow YAML file
name: GHA Workflow on: - workflow_dispatch jobs: build-deploy: runs-on: ubuntu-latest permissions: id-token: write contents: read steps: - name: Compile Code run: echo "Compiling..." - name: Produce Binary run: echo "Generating binary..." - name: Push binary run: echo "Pushing Binary to ECR..." - name: Register Build Artifacts in CloudBees Unify uses: cloudbees-io-gha/register-build-artifact@v3 id: go-action with: name: "gha-artifact-step" version: 1.0.0 url: "docker.io/example:latest" digest: sha256:1234567890abcdef123456123456abcdef789078907890abcdefabcdef123456 label: For testing type: docker - name: Deploy artifact run: echo 'Deploying Build ArtifactId ${{ steps.go-action.outputs.cbp_artifact_id }}' - name: Register deployment uses: cloudbees-io-gha/register-deployed-artifact@v1 with: target-environment: pre-prod labels: For testing artifact-id: ${{ steps.go-action.outputs.cbp_artifact_id }}

After the run completes, the artifact information is displayed in the Run details  Deployments tab in CloudBees Unify.