Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md with more detailed manual deploy steps #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Easily build and test your Unity project.

We welcome [issues](https://github.com/game-ci/unity-orb/issues) to and [pull requests](https://github.com/game-ci/unity-orb/pulls) against this repository!

### How to Publish An Update
### How to Publish An Update (for maintainers)

1. Merge pull requests with desired changes to the main branch.
- For the best experience, squash-and-merge and use [Conventional Commit Messages](https://conventionalcommits.org/).
Expand All @@ -38,9 +38,49 @@ If you want a private orb for your build env. The following steps allow you to d
[Manual Orb Authoring Process](https://circleci.com/docs/orb-author-validate-publish/#publish-your-orb)

```bash
circleci namespace create <name> --org-id <your-organization-id>
circleci orb create <my-namespace>/<my-orb-name> --private
circleci orb pack src > unity-orb.yml
circleci orb publish unity-orb.yml <my-namespace>/<my-orb-name>@dev:first
circleci orb publish promote <my-namespace>/<my-orb-name>@dev:first patch
# Define variables
REPO_URL="[email protected]:game-ci/unity-orb.git" # Change to your fork if needed
BRANCH_NAME="main" # Use desired branch for testing PRs
NAMESPACE="your-username" # Typically your GitHub username; Note: you can only have one namespace per CircleCI org
ORG_ID="00000000-0000-0000-0000-000000000000" # Found in CircleCI Organization Settings > Overview page
ORB_NAME="unity-orb-private" # Private Orbs can't become public, so using `-private` allows your_username/unity-orb to be public later

Comment on lines +41 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add warning about placeholder values.

The variable definitions contain placeholder values that should be clearly marked as such to prevent accidental usage.

Consider updating the variable definitions like this:

-REPO_URL="[email protected]:game-ci/unity-orb.git" # Change to your fork if needed
-NAMESPACE="your-username" # Typically your GitHub username
-ORG_ID="00000000-0000-0000-0000-000000000000" # Found in CircleCI Organization Settings
+# IMPORTANT: Replace these placeholder values with your actual values
+REPO_URL="<your-fork-url>" # Example: [email protected]:username/unity-orb.git
+NAMESPACE="<your-namespace>" # Typically your GitHub username
+ORG_ID="<your-org-id>" # Found in CircleCI Organization Settings > Overview page
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Define variables
REPO_URL="[email protected]:game-ci/unity-orb.git" # Change to your fork if needed
BRANCH_NAME="main" # Use desired branch for testing PRs
NAMESPACE="your-username" # Typically your GitHub username; Note: you can only have one namespace per CircleCI org
ORG_ID="00000000-0000-0000-0000-000000000000" # Found in CircleCI Organization Settings > Overview page
ORB_NAME="unity-orb-private" # Private Orbs can't become public, so using `-private` allows your_username/unity-orb to be public later
# Define variables
# IMPORTANT: Replace these placeholder values with your actual values
REPO_URL="<your-fork-url>" # Example: [email protected]:username/unity-orb.git
BRANCH_NAME="main" # Use desired branch for testing PRs
NAMESPACE="<your-namespace>" # Typically your GitHub username
ORG_ID="<your-org-id>" # Found in CircleCI Organization Settings > Overview page
ORB_NAME="unity-orb-private" # Private Orbs can't become public, so using `-private` allows your_username/unity-orb to be public later

# You should not have to change these variables
SRC_DIR="src"
OUTPUT_FILE="unity-orb.yml"
DEV_VERSION="dev:first"
RELEASE_TYPE="patch"

# Clone the repository
git clone $REPO_URL unity-orb
cd unity-orb || exit

# Checkout the desired branch
git checkout $BRANCH_NAME

# Authenticate with CircleCI
# You will need a token from https://app.circleci.com/settings/user/tokens to continue
circleci setup

# Create a CircleCI namespace
circleci namespace create $NAMESPACE --org-id $ORG_ID

# Create a private Orb under the namespace
# Note: Error: To create private orbs, your organization must enable the 'Allow private orbs' feature in Org Settings > Security.
circleci orb create $NAMESPACE/$ORB_NAME --private

# Pack the Orb configuration from the source directory
circleci orb pack $SRC_DIR > $OUTPUT_FILE

# Publish the packed Orb to a development version
circleci orb publish $OUTPUT_FILE $NAMESPACE/$ORB_NAME@$DEV_VERSION
Comment on lines +72 to +76
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add validation step before publishing.

The script packs and publishes the orb without validating its contents.

Add a validation step:

 # Pack the Orb configuration from the source directory
 circleci orb pack $SRC_DIR > $OUTPUT_FILE
 
+# Validate the Orb before publishing
+if ! circleci orb validate $OUTPUT_FILE; then
+    echo "Error: Orb validation failed"
+    exit 1
+fi
+
 # Publish the packed Orb to a development version
 circleci orb publish $OUTPUT_FILE $NAMESPACE/$ORB_NAME@$DEV_VERSION
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Pack the Orb configuration from the source directory
circleci orb pack $SRC_DIR > $OUTPUT_FILE
# Publish the packed Orb to a development version
circleci orb publish $OUTPUT_FILE $NAMESPACE/$ORB_NAME@$DEV_VERSION
# Pack the Orb configuration from the source directory
circleci orb pack $SRC_DIR > $OUTPUT_FILE
# Validate the Orb before publishing
if ! circleci orb validate $OUTPUT_FILE; then
echo "Error: Orb validation failed"
exit 1
fi
# Publish the packed Orb to a development version
circleci orb publish $OUTPUT_FILE $NAMESPACE/$ORB_NAME@$DEV_VERSION


# Promote the Orb to a stable release version
circleci orb publish promote $NAMESPACE/$ORB_NAME@$DEV_VERSION $RELEASE_TYPE

# You can now use the Orb in your CircleCI configuration
echo "Orb published successfully"

# Retrieve information about the Orb
circleci orb info $NAMESPACE/$ORB_NAME
```