Initializes a git repository of the content in the workspace, and publishes it to AWS CodeCommit.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| accountId | string | The AWS account ID to create the resource. | |
| region | string | The AWS region to create the resource. | |
| repositoryName | string | Name of the AWS CodeCommit repository. | |
| defaultBranch | string | - | |
| 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. | |
| gitCommitMessage | string | - | |
| gitAuthorName | string | - | |
| gitAuthorEmail | string | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| arn | string | ARN of the repository | |
| repositoryName | string | The repository's name | |
| repositoryId | string | The ID of the repository | |
| cloneUrlHttp | string | The URL to use for cloning the repository over HTTPS | |
| cloneUrlSsh | string | The URL to use for cloning the repository over SSH |
Usage Examples
Publish the entire workspace to a new CodeCommit repository on main
Fetch a service template with fetch:template and publish the whole workspace to a new CodeCommit repository using main as the default branch.
steps:
- id: fetch-service
action: 'fetch:template'
input:
url: 'https://github.com/acme/templates/node-express-service'
targetPath: '.'
values:
serviceId: ${{ parameters.serviceId }}
owner: ${{ parameters.owner }}
port: 8080
- id: publish-codecommit
action: 'aws:codecommit:publish'
input:
repositoryName: 'orders-service'
defaultBranch: 'main'
gitCommitMessage: 'chore: initial commit for orders-service'
gitAuthorName: 'Backstage Scaffolder'
gitAuthorEmail: '[email protected]'Publish only a subdirectory to CodeCommit using develop as the default branch
Use fetch:template to create a monorepo structure, then publish only the API service subfolder to CodeCommit with develop as the default branch.
steps:
- id: fetch-monorepo
action: 'fetch:template'
input:
url: 'https://github.com/acme/templates/monorepo-skeleton'
targetPath: '.'
values:
system: ${{ parameters.system }}
apiServiceId: ${{ parameters.apiServiceId }}
uiServiceId: ${{ parameters.uiServiceId }}
- id: publish-api
action: 'aws:codecommit:publish'
input:
repositoryName: 'inventory-api'
defaultBranch: 'develop'
sourcePath: './services/api'
region: 'eu-west-1'
gitCommitMessage: 'feat: scaffold inventory API service'
gitAuthorName: ${{ parameters.authorName }}
gitAuthorEmail: ${{ parameters.authorEmail }}Publish to a specific AWS account and region
Target a specific AWS account and region for repository creation. This is useful in multi account setups where environments are isolated.
steps:
- id: fetch-service
action: 'fetch:template'
input:
url: 'https://github.com/acme/templates/python-fastapi-service'
targetPath: '.'
values:
serviceId: ${{ parameters.serviceId }}
description: ${{ parameters.description }}
- id: publish-to-account
action: 'aws:codecommit:publish'
input:
accountId: ${{ parameters.awsAccountId }}
region: ${{ parameters.awsRegion }}
repositoryName: ${{ parameters.repoName }}
defaultBranch: 'trunk'
gitCommitMessage: 'chore: initial import for ${{ parameters.repoName }}'
gitAuthorName: 'Service Factory'
gitAuthorEmail: '[email protected]'Use user provided author info and custom commit message
Let users supply commit author details and a custom message, then publish to CodeCommit. This keeps audit information consistent with your internal standards.
steps:
- id: fetch-template
action: 'fetch:template'
input:
url: 'https://github.com/acme/templates/go-chi-service'
targetPath: '.'
values:
serviceId: ${{ parameters.serviceId }}
owner: ${{ parameters.owner }}
- id: publish-with-author
action: 'aws:codecommit:publish'
input:
repositoryName: ${{ parameters.serviceId }}
defaultBranch: ${{ parameters.defaultBranch }}
gitCommitMessage: ${{ parameters.initialCommitMessage }}
gitAuthorName: ${{ parameters.authorName }}
gitAuthorEmail: ${{ parameters.authorEmail }}Build the repository name from multiple parameters and set a regional target
Compose the repository name from system and service identifiers, publish a specific folder, and target a regional account setup.
steps:
- id: fetch-multi
action: 'fetch:template'
input:
url: 'https://github.com/acme/templates/kotlin-spring-service'
targetPath: '.'
values:
system: ${{ parameters.system }}
serviceId: ${{ parameters.service }}
owner: ${{ parameters.owner }}
- id: publish-composed-name
action: 'aws:codecommit:publish'
input:
accountId: '555555555555'
region: 'ap-southeast-2'
repositoryName: '${{ parameters.system }}-${{ parameters.service }}'
defaultBranch: 'main'
sourcePath: './service'
gitCommitMessage: 'init: scaffold ${{ parameters.system }}-${{ parameters.service }}'
gitAuthorName: 'Platform Engineering'
gitAuthorEmail: '[email protected]'