Astro CI/CD templates for Harness
Use the following CI/CD template to automate a deploy with a single branch implementation, which requires only one Astro Deployment, from a Git repository to Astro with Harness.
If you use the dag-only deploy feature on Astro or you’re interested in a multiple-branch implementation, see Template overview to configure your own. To learn more about CI/CD on Astro, see Choose a CI/CD strategy.
Prerequisites
- An Astro project hosted in a Git repository that Harness can access.
- An Astro Deployment.
- A Deployment API token, Workspace API token, or Organization API token.
- Access to Harness.
Deploy template
-
Create a Harness CI pipeline and configure it as Remote with a Third-party Git provider.
-
Authenticate to your Git provider.
-
Choose Cloud for infrastructure, and Linux and ARM64 for platform. If you want to use other infrastructure, see Harness’s guide for implementation.
-
Add a step, then choose Run as the template type from the step library. Use
sh
for your shell. Only one step is needed to deploy code from your Git repository to Astro, but you can add more if your use case requires. -
Paste the following code into the command prompt and apply changes.
- Add the following environment variables in Harness:
ORGANIZATION_ID
: The ID for your Organization.
DEPLOYMENT_ID
: The ID for your Deployment.
ASTRO_API_TOKEN
: The value for your API token as a secret.
ASTRO_PROJECT_PATH
: The default value is /harness/
and is followed by the folder name used in the Git provider for Astro, if applicable.
- Run the pipeline. Harness requires you to save changes before executing. Logs will display any errors.