Skip to main content

Publishing with GitHub Actions

This guide will walk you through the process of setting up a GitHub Action to build and publish your bundle to your Massdriver organization.

note

Before getting started, you'll need:

Set secrets

NameDescriptionTypeNotes
MASSDRIVER_ORG_IDYour Massdriver organization IDsecretCopy your Organization ID
MASSDRIVER_API_KEYYour Massdriver API keysecretCreate a Service Account

Workflow file

To set up the GitHub Action, create a new file named publish.yaml in the .github/workflows directory of your GitHub repository. You can use this workflow below as a starting point:

.github/workflows/publish.yaml
name: Publish to Massdriver
on:
push:
branches: [main]

jobs:
publish:
runs-on: ubuntu-latest
env:
MASSDRIVER_ORG_ID: ${{ secrets.MASSDRIVER_ORG_ID }}
MASSDRIVER_API_KEY: ${{ secrets.MASSDRIVER_API_KEY }}
steps:
- uses: actions/checkout@v4
- name: Install Massdriver CLI
uses: massdriver-cloud/actions@v4
- name: Publish Bundle
uses: massdriver-cloud/actions/bundle_publish@v4
with:
build-directory: ./ # path to massdriver config directory, contains massdriver.yaml

This example is configured to trigger on pushes to the repository's main branch. Be sure to update the trigger to match your branching and git workflow process.

note

If your massdriver.yaml file is in a subdirectory, you can update the build-directory to point to that directory. For example, if your massdriver.yaml file is in the ./bundle directory, you can set the build-directory to ./bundle.

View the Massdriver GitHub Actions on the GitHub Marketplace.