Skip to content

Commit

Permalink
Merge pull request #244 from james-crowley/cci-releases
Browse files Browse the repository at this point in the history
Enables Support for tracking Orb Releaes in CircleCI Releases
  • Loading branch information
david-montano-circleci authored Dec 13, 2024
2 parents e8b6477 + 7606802 commit 3b18f4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/jobs/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ parameters:
This will attempt to attach the workspace at the path specified by the "orb_dir" parameter.
It is expected that the workspace will contain 'orb_source.tar.gz' which should contain one or more orb source files.
The tar file will be extracted to the "orb_dir" path.
release_environment:
description: Enables tracking of the orb release in a defined CircleCI Release's environment. Passing in no environment name will disable tracking.
type: string
default: ""

executor: << parameters.executor >>

Expand Down Expand Up @@ -125,6 +129,7 @@ steps:
ORB_VAL_TAG_PATTERN: <<parameters.tag_pattern>>
ORB_VAL_DEV_TAGS: <<parameters.dev_tags>>
ORB_VAL_CIRCLECI_API_HOST: <<parameters.circleci_api_host>>
ORB_VAL_RELEASE_ENVIRONMENT: <<parameters.release_environment>>
command: <<include(scripts/publish.sh)>>
- when:
condition: <<parameters.enable_pr_comment>>
Expand Down
6 changes: 6 additions & 0 deletions src/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ function publishOrb() {
#$1 = full tag

circleci orb publish --host "${ORB_VAL_CIRCLECI_API_HOST:-https://circleci.com}" --skip-update-check "${ORB_DIR}/${ORB_FILE}" "${ORB_VAL_ORB_NAME}@${1}" --token "$ORB_VAL_ORB_PUB_TOKEN"

# Track release if ORB_VAL_RELEASE_ENVIRONMENT is set
if [[ -n "${ORB_VAL_RELEASE_ENVIRONMENT}" ]]; then
circleci-agent run release log --environment-name="${ORB_VAL_RELEASE_ENVIRONMENT}" --component-name="${ORB_VAL_ORB_NAME}" --target-version="${1}"
fi

printf "\n"
{
printf "Your orb has been published to the CircleCI Orb Registry.\n"
Expand Down

0 comments on commit 3b18f4e

Please sign in to comment.