Initializes a git repository using the content of the workspace, and publishes it to Gitea.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| repoUrl | string | Repository Location | |
| signCommit | boolean | Sign commit with configured PGP private key | |
| sourcePath | string | - | |
| 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 new private service repository with main as the default branch
Fetch template files with fetch:template and publish them to a private Gitea repository. Sets author information, a custom commit message, and registers the component with catalog:register.
steps:
- id: fetch
action: fetch:template
input:
url: ./skeletons/service
values:
name: ${{ parameters.name }}
description: ${{ parameters.description }}
- id: publish
action: publish:gitea
input:
repoUrl: gitea.example.com?owner=platform&repo=${{ parameters.name }}
description: ${{ parameters.description }}
defaultBranch: main
repoVisibility: private
gitCommitMessage: "chore: scaffold ${{ parameters.name }}"
gitAuthorName: "Backstage Scaffolder"
gitAuthorEmail: "[email protected]"
- id: register
action: catalog:register
input:
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
catalogInfoPath: "/catalog-info.yaml"Publish only a subdirectory to a public repository
Publish just the packages/service subfolder of the workspace to a new public Gitea repository. Logs the repository URL and initial commit hash using debug:log.
steps:
- id: fetch
action: fetch:template
input:
url: ./monorepo-template
values:
name: ${{ parameters.serviceName }}
description: ${{ parameters.description }}
- id: publish
action: publish:gitea
input:
repoUrl: gitea.example.com?owner=team-sre&repo=${{ parameters.serviceName }}
description: ${{ parameters.description }}
repoVisibility: public
sourcePath: packages/service
gitCommitMessage: "feat: initialize ${{ parameters.serviceName }} from template"
- id: log
action: debug:log
input:
message: "Repo: ${{ steps.publish.output.remoteUrl }} @ ${{ steps.publish.output.commitHash }}"Signed initial commit on a custom develop branch
Create a private repository on an on-prem Gitea host with a signed initial commit and a develop default branch. Use this when commit signing is required for auditing.
steps:
- id: fetch
action: fetch:template
input:
url: ./skeletons/service
values:
name: ${{ parameters.name }}
description: ${{ parameters.description }}
- id: publish
action: publish:gitea
input:
repoUrl: gitea.corp.local?owner=platform&repo=${{ parameters.name }}
description: ${{ parameters.description }}
defaultBranch: develop
repoVisibility: private
gitCommitMessage: "init: ${{ parameters.name }} (signed)"
gitAuthorName: "Platform Automation"
gitAuthorEmail: "[email protected]"
signCommit: true
- id: register
action: catalog:register
input:
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
catalogInfoPath: "/catalog-info.yaml"Owner and visibility chosen by parameters
Build the repoUrl from user-selected owner and visibility parameters. This pattern supports publishing to different teams or orgs from one template.
steps:
- id: fetch
action: fetch:template
input:
url: ./skeletons/library
values:
name: ${{ parameters.repoName }}
description: ${{ parameters.description }}
- id: publish
action: publish:gitea
input:
repoUrl: gitea.example.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}
description: ${{ parameters.description }}
repoVisibility: ${{ parameters.visibility }}
gitCommitMessage: "build: scaffold ${{ parameters.repoName }} for ${{ parameters.owner }}"
- id: register
action: catalog:register
input:
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
catalogInfoPath: "/catalog-info.yaml"Publish generated artifacts from a build output directory
Publish only the dist directory to a public repository. Use this when the template builds or compiles files and you only want to commit the build output.
steps:
- id: fetch
action: fetch:template
input:
url: ./skeletons/static-site
values:
name: ${{ parameters.siteName }}
description: ${{ parameters.description }}
# Assume a prior build step created the dist directory in the workspace
- id: publish
action: publish:gitea
input:
repoUrl: gitea.example.com?owner=web&repo=${{ parameters.siteName }}
description: ${{ parameters.description }}
repoVisibility: public
defaultBranch: main
sourcePath: dist
gitCommitMessage: "docs: add generated site for ${{ parameters.siteName }}"
- id: register
action: catalog:register
input:
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
catalogInfoPath: "/catalog-info.yaml"