Giter VIP home page Giter VIP logo

hubspot-cms-deploy-action's Introduction

HubSpot CMS Deploy Action

Automatically deploy a HubSpot CMS project to your account ๐Ÿš€

Usage

In your GitHub repo, create two new secrets for:

  • HUBSPOT_PORTAL_ID - This is your HubSpot account ID
  • HUBSPOT_PERSONAL_ACCESS_KEY - Your personal access key

This guide walks through setting up a new workflow file that automatically uploads new changes on your main branch to your HubSpot CMS account. If you're adding a deployment step to an existing workflow, you can skip ahead.

  1. In your project, create a GitHub Action workflow file at .github/workflows/main.yml
  2. Copy the following example workflow into your main.yml file.
on:
  push:
    branches:
    - main
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/[email protected]
      - name: HubSpot Deploy Action
        uses: HubSpot/[email protected]
        with:
          src_dir: <src> ## ex. src
          dest_dir: <src> ## ex. my-theme
          portal_id: ${{ secrets.hubspot_portal_id }}
          personal_access_key: ${{ secrets.hubspot_personal_access_key }}
  1. Replace the src_dir with the directory of your CMS project in your repo
  2. Replace the dest_dir with the directory it should be uploaded to in your target account
  3. Commit and merge your changes

Note: Do not change the portal_id or personal_access_key values in your workflow. Auth related values should only be stored as GitHub secrets.

Deploying to a staging account

If you'd like to auto-deploy to a staging account you have in HubSpot, you can create an additional workflow that runs on push to your associated stanging branch in your repo.

on:
  push:
    branches:
    - qa
...
portal_id: ${{ secrets.staging_account_id }}

Integrating into an existing workflow

To add HubSpot CMS deployment as a step in an existing GitHub Action workflow, add the following step:

- name: HubSpot Deploy Action
  uses: HubSpot/[email protected]
  with:
    src_dir: <src> ## ex. src
    dest_dir: <src> ## ex. my-theme
    portal_id: ${{ secrets.hubspot_portal_id }}
    personal_access_key: ${{ secrets.hubspot_personal_access_key }}

Note: You can configure your action to run based on different criteria, such as pushing to a QA branch. Learn more about events that trigger actions here.

Action Spec

Inputs

  • src_dir - Project directory relative to the repo
  • dest_dir - Target directory in HubSpot

Secrets

  • HUBSPOT_PORTAL_ID - Target account id
  • HUBSPOT_PERSONAL_ACCESS_KEY - Authentication key

hubspot-cms-deploy-action's People

Contributors

anthmatic avatar thewebtech avatar tanyascales avatar thetwopct avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.