Initializes a git repository of the content in the workspace, and publishes it to Bitbucket.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| token | string | The token to use for authorization to BitBucket | |
| repoUrl | string | Repository Location | |
| enableLFS | boolean | Enable LFS for the repository. Only available for hosted Bitbucket. | |
| signCommit | boolean | Sign commit with configured PGP private key | |
| sourcePath | string | Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository. | |
| description | string | Repository Description | |
| defaultBranch | string | - | |
| gitAuthorName | string | - | |
| gitAuthorEmail | string | - | |
| repoVisibility | string | - | |
| gitCommitMessage | string | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| remoteUrl | string | A URL to the repository with the provider | |
| commitHash | string | The git commit hash of the initial commit | |
| repoContentsUrl | string | A URL to the root of the repository |
Usage Examples
Publish a private Bitbucket Cloud repo with custom commit metadata
Creates a private repository on Bitbucket Cloud with main as the default branch. After fetching the template with fetch:template it publishes the generated code and sets commit author details.
steps:
- id: fetch-base
action: fetch:template
input:
url: https://github.com/acme-org/software-templates/tree/main/templates/service-skeleton
values:
name: ${{ parameters.serviceName }}
owner: ${{ parameters.owner }}
description: ${{ parameters.description }}
- id: publish-repo
action: publish:bitbucket
input:
repoUrl: bitbucket.org?workspace=acme-ws&project=ENG&repo=${{ parameters.serviceName }}
description: ${{ parameters.description }}
repoVisibility: private
defaultBranch: main
gitCommitMessage: "chore: initial scaffold for ${{ parameters.serviceName }}"
gitAuthorName: "Jane Doe"
gitAuthorEmail: "jane.doe@acme.com"Publish a subdirectory to a public repo using a token and register in the catalog
Publishes only the services/api folder as the repository root to a public Bitbucket Cloud repo using a personal access token. After publishing it registers the component with catalog:register.
steps:
- id: fetch-template
action: fetch:template
input:
url: https://github.com/acme-org/software-templates/tree/main/templates/multiservice
values: ${{ parameters }}
- id: publish-api
action: publish:bitbucket
input:
repoUrl: bitbucket.org?workspace=acme-ws&project=ENG&repo=${{ parameters.apiName }}
description: "Public API for payments"
repoVisibility: public
defaultBranch: develop
sourcePath: services/api
token: ${{ secrets.bitbucketToken }}
gitCommitMessage: "feat: bootstrap API service"
gitAuthorName: "Service Generator"
gitAuthorEmail: "scaffolder@acme.com"
- id: register
action: catalog:register
input:
catalogInfoUrl: ${{ steps.publish-api.output.repoContentsUrl }}/catalog-info.yamlEnable Git LFS and sign the initial commit
Enables Git LFS support and signs the initial commit for repositories hosted on Bitbucket Cloud. Use this when the template includes large binary assets in the assets directory and you want signed commits.
steps:
- id: fetch-assets
action: fetch:template
input:
url: https://github.com/acme-org/software-templates/tree/main/templates/ml-model
values:
name: ${{ parameters.modelName }}
owner: ${{ parameters.owner }}
- id: publish-with-lfs
action: publish:bitbucket
input:
repoUrl: bitbucket.org?workspace=acme-ws&project=DS&repo=${{ parameters.modelName }}
description: "ML model artifacts and serving code"
repoVisibility: private
defaultBranch: main
sourcePath: assets
enableLFS: true
signCommit: true
token: ${{ secrets.bitbucketToken }}
gitCommitMessage: "build: initial model drop with LFS"
gitAuthorName: "CI Bot"
gitAuthorEmail: "ci@acme.com"Publish to self hosted Bitbucket Server with project key
Publishes to an on premises Bitbucket Server using a project key. This uses a token for authentication and logs the created repository URL with debug:log.
steps:
- id: fetch-service
action: fetch:template
input:
url: https://github.com/acme-org/software-templates/tree/main/templates/java-service
values: ${{ parameters }}
- id: publish-server
action: publish:bitbucket
input:
repoUrl: bitbucket.acme.corp?project=PLAT&repo=${{ parameters.repoName }}
description: "Platform service for internal use"
defaultBranch: main
token: ${{ secrets.bbServerToken }}
gitCommitMessage: "chore: scaffold ${{ parameters.repoName }}"
gitAuthorName: "Backstage Bot"
gitAuthorEmail: "backstage-bot@acme.corp"
- id: log-remote
action: debug:log
input:
message: "Repository created at ${{ steps.publish-server.output.remoteUrl }}"Custom default branch and output usage in follow up steps
Creates a private repo with a custom default branch release and then logs the commit hash. Use this to wire outputs from publish into later steps such as notifications or tagging with debug:log.
steps:
- id: fetch-app
action: fetch:template
input:
url: https://github.com/acme-org/software-templates/tree/main/templates/node-service
values:
name: ${{ parameters.appName }}
owner: ${{ parameters.owner }}
description: ${{ parameters.description }}
- id: publish-app
action: publish:bitbucket
input:
repoUrl: bitbucket.org?workspace=acme-ws&project=OPS&repo=${{ parameters.appName }}
description: ${{ parameters.description }}
repoVisibility: private
defaultBranch: release
gitCommitMessage: "feat: bootstrap ${{ parameters.appName }}"
gitAuthorName: "DevEx Team"
gitAuthorEmail: "devex@acme.com"
- id: log-commit
action: debug:log
input:
message: "Initial commit ${{ steps.publish-app.output.commitHash }} pushed to ${{ steps.publish-app.output.remoteUrl }}"