Composable workflow actions to upload, deploy, and validate your HubSpot Developer Projects 🚀
In your GitHub repo, create two new secrets for:
HUBSPOT_ACCOUNT_ID- This is your HubSpot account IDHUBSPOT_PERSONAL_ACCESS_KEY- Your personal access key
The recommended way to leverage these in your actions is to set them as environment variables at the workflow level:
env:
DEFAULT_ACCOUNT_ID: ${{ secrets.HUBSPOT_ACCOUNT_ID }}
DEFAULT_PERSONAL_ACCESS_KEY: ${{ secrets.HUBSPOT_PERSONAL_ACCESS_KEY }}
DEFAULT_CLI_VERSION: "7.9.0" # Optional: specify a CLI version (it will default to a stable version).TIP: The DEFAULT_CLI_VERSION will default to a specific stable version. If the DEFAULT_CLI_VERSION is used, we recommend targeting a specific cli version instead of using dist-tags like "latest" or "next" to prevent new releases from impacting your CI/CD flow.
Now, set up a new workflow file that automatically uploads new changes on your main branch to your HubSpot account.
- In your project, create a GitHub Action workflow file at
.github/workflows/main.yml - Copy the following example workflow into your
main.ymlfile.
Note: Replace - main with your default branch name if it's something other than main
on:
push:
branches:
- main
env:
DEFAULT_ACCOUNT_ID: ${{ secrets.HUBSPOT_ACCOUNT_ID }}
DEFAULT_PERSONAL_ACCESS_KEY: ${{ secrets.HUBSPOT_PERSONAL_ACCESS_KEY }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: HubSpot Project Action
uses: HubSpot/[email protected]- Commit and merge your changes
Important! Do not change the account_id or personal_access_key values in your workflow. Auth related values should only be stored as GitHub secrets.
This should enable automatic uploads to your target HubSpot account with every commit into main 🎉
This repository uses semantic versioning with Git tags.
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality additions
- PATCH version for backwards-compatible bug fixes
Actions can be referenced using the following format:
HubSpot/hubspot-project-actions/[action-name]@v[version]
For example:
HubSpot/[email protected]HubSpot/hubspot-project-actions/[email protected]HubSpot/hubspot-project-actions/[email protected]HubSpot/hubspot-project-actions/[email protected]
All actions support the DEFAULT_ACCOUNT_ID, DEFAULT_PERSONAL_ACCESS_KEY, DEFAULT_CLI_VERSION, and DEFAULT_DEBUG env variables. There's no need to pass them into each action individually as inputs.
TIP: Set DEFAULT_DEBUG: true or pass debug: true to any action to enable verbose CLI output. This is useful for troubleshooting failures.
Uploads and builds a HubSpot project in your account. If auto-deploy is enabled, the build will also be deployed to your account.
See the project-upload docs for detailed specs.
Example usage:
- uses: HubSpot/hubspot-project-actions/[email protected]
with:
project_dir: "./my-project" # optionalDeploys a specific build of a HubSpot project.
See the project-deploy docs for detailed specs.
Example usage:
- uses: HubSpot/hubspot-project-actions/[email protected]
with:
build_id: ${{ steps.upload-action-step.outputs.build_id }}
project_dir: "./my-project" # optionalValidates the configuration of a HubSpot project.
See the project-validate docs for detailed specs.
Example usage:
- uses: HubSpot/hubspot-project-actions/[email protected]
with:
project_dir: "./my-project" # optionalInstalls the HubSpot CLI. Only installs if the cli has not already been installed by an earlier step.
See the install-hubspot-cli docs for detailed specs.
Example usage:
- uses: HubSpot/hubspot-project-actions/[email protected]
with:
cli_version: "7.9.0"