{"id":22351871,"url":"https://github.com/screwdriver-cd/template-main","last_synced_at":"2025-06-11T04:14:10.298Z","repository":{"id":18707776,"uuid":"84869228","full_name":"screwdriver-cd/template-main","owner":"screwdriver-cd","description":"Validates templates","archived":false,"fork":false,"pushed_at":"2025-03-03T21:17:53.000Z","size":86,"stargazers_count":2,"open_issues_count":1,"forks_count":7,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-18T13:02:03.880Z","etag":null,"topics":["screwdriver","template"],"latest_commit_sha":null,"homepage":"https://cd.screwdriver.cd/pipelines/493","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/screwdriver-cd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-03-13T20:02:42.000Z","updated_at":"2025-03-03T21:16:21.000Z","dependencies_parsed_at":"2024-02-07T22:45:37.333Z","dependency_job_id":null,"html_url":"https://github.com/screwdriver-cd/template-main","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Ftemplate-main","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Ftemplate-main/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Ftemplate-main/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Ftemplate-main/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/screwdriver-cd","download_url":"https://codeload.github.com/screwdriver-cd/template-main/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Ftemplate-main/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":257362980,"owners_count":22534724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["screwdriver","template"],"created_at":"2024-12-04T12:16:07.493Z","updated_at":"2025-06-11T04:14:10.286Z","avatar_url":"https://github.com/screwdriver-cd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# template-main\n[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]\n\n\u003e Validates and publishes templates\n\n## Usage\n\n```bash\nnpm install screwdriver-template-main\n```\n\nCreate a Screwdriver pipeline with your template repo and start the build to validate and publish it.\n\nTo update a Screwdriver template, make changes in your SCM repository and rerun the pipeline build.\n\n### Validating a template\n\nRun the `template-validate` script. By default, the path `./sd-template.yaml` will be read. However, a user can specify a custom path using the env variable: `SD_TEMPLATE_PATH`.\n\nExample `screwdriver.yaml`:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - install: npm install screwdriver-template-main\n            - validate: ./node_modules/.bin/template-validate\n        environment:\n            SD_TEMPLATE_PATH: ./path/to/template.yaml\n```\n\n`template-validate` can print a result as json by passing `--json` option to the command.\n\n```\n$ ./node_modules/.bin/template-validate --json\n{\"valid\":true}\n```\n\n### Publishing a template\n\nRun the `template-publish` script. By default, the path `./sd-template.yaml` will be read. However, a user can specify a custom path using the env variable: `SD_TEMPLATE_PATH`.\n\nExample `screwdriver.yaml` with validation and publishing:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - install: npm install screwdriver-template-main\n            - validate: ./node_modules/.bin/template-validate\n    publish:\n        requires: main\n        steps:\n            - install: npm install screwdriver-template-main\n            - publish: ./node_modules/.bin/template-publish --tag stable\n```\n\n`template-publish` can print a result as json by passing `--json` option to the command. `template-publish` will tag the published version as well. The default tag is `latest` if none is specified.\n\n```\n$ ./node_modules/.bin/template-publish --json\n{name:\"template/foo\",version:\"1.2.3\",tag:\"stable\"}\n```\n\n### Removing a template\n\nTo remove a template, run the `template-remove` script. You'll need to add an argument for the template name. Removing a template will remove _all_ of its versions.\n\nExample `screwdriver.yaml` with validation and publishing, and template removal as a detached job:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - install: npm install screwdriver-template-main\n            - validate: ./node_modules/.bin/template-validate\n    publish:\n        requires: main\n        steps:\n            - install: npm install screwdriver-template-main\n            - publish: ./node_modules/.bin/template-publish\n    remove_template:\n        steps:\n            - install: npm install screwdriver-template-main\n            - remove: ./node_modules/.bin/template-remove --name templateName\n```\n\n`template-remove` can print a result as json by passing `--json` option to the command.\n\n```\n$ ./node_modules/.bin/template-remove --json --name templateName\n{\"name\":\"templateName\"}\n```\n\n### Removing a template version\n\nTo remove a specific version of a template, run the `template-remove-version` binary. This must be done in the same pipeline that published the template. You'll need to specify the template name and version as arguments.\nRemoving a template version will remove all the tags associated with it.\n\nExample `screwdriver.yaml` with validation, publishing and tagging, and version removal as a detached job:\n\n```yaml\nshared:\n    image: node:22\n    steps:\n        - init: npm install screwdriver-template-main\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: ./node_modules/.bin/template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: ./node_modules/.bin/template-publish\n            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.0.0 --tag latest\n    detached_remove_version:\n        steps:\n            - remove: ./node_modules/.bin/template-remove-version --name templateName --version 1.0.0\n```\n\n`template-remove-version` can print a result as json by passing `--json` option to the command.\n\n### Tagging a template\n\nOptionally, tag a template using the `template-tag` script. This must be done in the same pipeline that published the template. You'll need to add arguments for the template name and tag. You can optionally specify a version; the version must be an exact version, not just a major or major.minor one. If omitted, the latest version will be tagged.\n\nExample `screwdriver.yaml` with validation and publishing and tagging:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - install: npm install screwdriver-template-main\n            - validate: ./node_modules/.bin/template-validate\n    publish:\n        requires: main\n        steps:\n            - install: npm install screwdriver-template-main\n            - publish: ./node_modules/.bin/template-publish\n            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.2.3 --tag stable\n```\n\n`template-tag` can print a result as json by passing `--json` option to the command.\n\n```\n$ ./node_modules/.bin/template-tag --json --name templateName --version 1.2.3 --tag stable\n{\"name\":\"templateName\",\"tag\":\"stable\",\"version\":\"1.2.3\"}\n```\n\n### Removing a template tag\n\n\nTo remove a template tag, run the `template-remove-tag` binary. This must be done in the same pipeline that published the template. You'll need to specify the template name and tag as arguments.\n\nExample `screwdriver.yaml` with validation, publishing and tagging, and tag removal as a detached job:\n\n```yaml\nshared:\n    image: node:22\n    steps:\n        - init: npm install screwdriver-template-main\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: ./node_modules/.bin/template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: ./node_modules/.bin/template-publish\n            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.0.0 --tag latest\n    detached_remove_tag:\n        steps:\n            - remove: ./node_modules/.bin/template-remove-tag --name templateName --tag latest\n```\n\n`template-remove-tag` can print a result as json by passing `--json` option to the command.\n\n```\n$ ./node_modules/.bin/template-remove-tag --json --name templateName --tag stable\n{\"name\":\"templateName\",\"tag\":\"stable\"}\n```\n\n### Getting the version from a template tag\n\nTo get the version from a template tag, run the `template-get-version-from-tag` binary. This must be done in the same pipeline that published the template. You'll need to add arguments for the template name and tag.\n\nExample `screwdriver.yaml` with validation, publishing and tagging, and getting a version as a detached job:\n\n```yaml\nshared:\n    image: node:22\n    steps:\n        - init: npm install screwdriver-template-main\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: ./node_modules/.bin/template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: ./node_modules/.bin/template-publish\n            - tag: ./node_modules/.bin/template-tag --name templateName --version 1.0.0 --tag latest\n    detached_get_version_from_tag:\n        steps:\n            - get_version: ./node_modules/.bin/template-get-version-from-tag --name templateName --tag latest\n```\n\n## Pipeline Templates\n\n### Validating a template\n\nRun the `pipeline-template-validate` script. By default, the path `./sd-template.yaml` will be read. However, a user can specify a custom path using the env variable: `SD_TEMPLATE_PATH`.\n\nExample `screwdriver.yaml`:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: npx -y -p screwdriver-template-main pipeline-template-validate\n        environment:\n            SD_TEMPLATE_PATH: ./path/to/pipeline-template.yaml\n```\n\n`pipeline-template-validate` can print a result as json by passing `--json` option to the command.\n\n```\n$ ./node_modules/.bin/pipeline-template-validate --json\n{\"valid\":true}\n```\nUsage with npx\n```\n$ npx -y -p screwdriver-template-main pipeline-template-validate\n{\"valid\":true}\n```\n\n\n### Publishing a pipeline template\n\nRun the `pipeline-template-publish` script. By default, the path `./sd-template.yaml` will be read. However, a user can specify a custom path using the env variable: `SD_TEMPLATE_PATH`.\n\nExample `screwdriver.yaml` with validation and publishing:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: npx -y -p screwdriver-template-main pipeline-template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: npx -y -p screwdriver-template-main pipeline-template-publish --tag stable\n```\n\n`pipeline-template-publish` can print a result as json by passing `--json` option to the command. `pipeline-template-publish` will tag the published version as well. The default tag is `latest` if none is specified.\n\n```\n$ ./node_modules/.bin/pipeline-template-publish --json\n{namespace:\"template\", name:\"foo\",version:\"1.2.3\",tag:\"stable\"}\n```\nUsage with npx\n```\n$ npx -y -p screwdriver-template-main pipeline-template-publish --json\n{namespace:\"template\", name:\"foo\",version:\"1.2.3\",tag:\"stable\"}\n```\n\n### Removing a template\n\nTo remove a template, run the `pipeline-template-remove` script. You'll need to add an argument for the template namespace, name. Removing a template will remove _all_ of its versions and tags.\n\nExample `screwdriver.yaml` with validation and publishing, and template removal as a detached job:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: npx -y -p screwdriver-template-main pipeline-template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: npx -y -p screwdriver-template-main pipeline-template-publish\n    remove_template:\n        steps:\n            - remove: npx -y -p screwdriver-template-main pipeline-template-remove --namespace templateNamespace --name templateName\n```\n\n`pipeline-template-remove` can print a result as json by passing `--json` option to the command.\n\n```\n$ ./node_modules/.bin/pipeline-template-remove --json --namespace templateNamespace --name templateName \n{\"namespace\":\"templateNamespace\", \"name\":\"templateName\"}\n```\nUsage with npx\n```\n$ npx -y -p screwdriver-template-main pipeline-template-remove --json --namespace templateNamespace --name templateName \n{\"namespace\":\"templateNamespace\", \"name\":\"templateName\"}\n```\n\n\n### Removing a pipeline template version\n\nTo remove a specific version of a template, run the `pipeline-template-remove-version` binary. This must be done in the same pipeline that published the template. You'll need to specify the template namespace, name and version as arguments.\nRemoving a template version will remove all the tags associated with it.\n\nExample `screwdriver.yaml` with validation, publishing and tagging, and version removal as a detached job:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: npx -y -p screwdriver-template-main pipeline-template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: npx -y -p screwdriver-template-main pipeline-template-publish\n            - tag: npx -y -p screwdriver-template-main pipeline-template-tag --namespace templateNamespace --name templateName --version 1.0.0 --tag latest\n    detached_remove_version:\n        steps:\n            - remove: npx -y -p screwdriver-template-main pipeline-template-remove-version --namespace templateNamespace --name templateName --version 1.0.0\n```\n\n`pipeline-template-remove-version` can print a result as json by passing `--json` option to the command.\n\n\n### Tagging a template\n\nOptionally, tag a template using the `pipeline-template-tag` script. This must be done in the same pipeline that published the template. You'll need to add arguments for the template namespace, name and tag. You can optionally specify a version; the version must be an exact version, not just a major or major.minor one. If omitted, the latest version will be tagged.\n\nExample `screwdriver.yaml` with validation and publishing and tagging:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: npx -y -p screwdriver-template-main pipeline-template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: npx -y -p screwdriver-template-main pipeline-template-publish\n            - tag: npx -y -p screwdriver-template-main pipeline-template-tag --namespace templateNamespace --name templateName --version 1.2.3 --tag stable\n```\n\n`pipeline-template-tag` can print a result as json by passing `--json` option to the command.\n\n```\n$ npx -y -p screwdriver-template-main pipeline-template-tag --json --name templateName --version 1.2.3 --tag stable\n{\"namespace\":\"templateNamespace\", \"name\":\"templateName\",\"tag\":\"stable\",\"version\":\"1.2.3\"}\n```\n\n### Removing a template tag\n\n\nTo remove a template tag, run the `pipeline-template-remove-tag` binary. This must be done in the same pipeline that published the template. You'll need to specify the template name and tag as arguments.\n\nExample `screwdriver.yaml` with validation, publishing and tagging, and tag removal as a detached job:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: ./node_modules/.bin/pipeline-template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: ./node_modules/.bin/pipeline-template-publish\n            - tag: ./node_modules/.bin/pipeline-template-tag --namespace templateNamespace --name templateName --version 1.0.0 --tag latest\n    detached_remove_tag:\n        steps:\n            - remove: ./node_modules/.bin/pipeline-template-remove-tag --namespace templateNamespace --name templateName --tag latest\n```\n\n`pipeline-template-remove-tag` can print a result as json by passing `--json` option to the command.\n\n```\n$ npx -y -p screwdriver-template-main pipeline-template-remove-tag --json --namespace templateNamespace --name templateName --tag stable\n{\"namespace\":\"templateNamespace\", \"name\":\"templateName\",\"tag\":\"stable\"}\n```\n\n### Getting the version from a template tag\n\nTo get the version from a template tag, run the `pipeline-template-get-version-from-tag` binary. This must be done in the same pipeline that published the template. You'll need to add arguments for the template name and tag.\n\nExample `screwdriver.yaml` with validation, publishing and tagging, and getting a version as a detached job:\n\n```yaml\nshared:\n    image: node:22\njobs:\n    main:\n        requires: [~pr, ~commit]\n        steps:\n            - validate: npx -y -p screwdriver-template-main pipeline-template-validate\n    publish:\n        requires: main\n        steps:\n            - publish: npx -y -p screwdriver-template-main pipeline-template-publish\n            - tag: npx -y -p screwdriver-template-main pipeline-template-tag --namespace templateNamespace --name templateName --version 1.0.0 --tag latest\n    detached_get_version_from_tag:\n        steps:\n            - get_version: npx -y -p screwdriver-template-main pipeline-template-get-version-from-tag --namespace templateNamespace --name templateName --tag latest\n```\n\n## Testing\n\n```bash\nnpm test\n```\n\n## License\n\nCode licensed under the BSD 3-Clause license. See LICENSE file for terms.\n\n[npm-image]: https://img.shields.io/npm/v/screwdriver-template-main.svg\n[npm-url]: https://npmjs.org/package/screwdriver-template-main\n[downloads-image]: https://img.shields.io/npm/dt/screwdriver-template-main.svg\n[license-image]: https://img.shields.io/npm/l/screwdriver-template-main.svg\n[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/template-main.svg\n[issues-url]: https://github.com/screwdriver-cd/template-main/issues\n[status-image]: https://cd.screwdriver.cd/pipelines/493/badge\n[status-url]: https://cd.screwdriver.cd/pipelines/493\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrewdriver-cd%2Ftemplate-main","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrewdriver-cd%2Ftemplate-main","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrewdriver-cd%2Ftemplate-main/lists"}