Deploying with GitHub Actions
This article shows you how to set up GitHub Actions to check your Email Design System (EDS) when a pull request is opened, and deploy it to EmailShepherd when the pull request is merged.
Keeping your EDS in Git means changes can be reviewed before they reach your emails. With these workflows, nothing is deployed until it’s been checked and merged.
Before you begin
Section titled “Before you begin”- Set up a repository for your EDS and push it to GitHub. See The EDS SDK.
- Find your workspace ID and EDS ID. They’re in the
.envfile in your repository, asEMAILSHEPHERD_WORKSPACE_IDandEMAILSHEPHERD_EDS_ID.
Add your API key to GitHub
Section titled “Add your API key to GitHub”- Create an API key with the Email design systems: Read and Write and Workspaces: Read scopes. See How to create an API key.
- In your GitHub repository, add it as a repository secret called
EMAILSHEPHERD_API_KEY.
Check pull requests
Section titled “Check pull requests”Create .github/workflows/validate.yml with the following, replacing the workspace and EDS IDs with your own:
name: Validate EDS
on: pull_request: branches: - main
jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies run: npm ci - name: Validate EDS run: npx emailshepherd validate env: EMAILSHEPHERD_WORKSPACE_ID: 'your-workspace-id' EMAILSHEPHERD_EDS_ID: 'your-email-design-system-id' EMAILSHEPHERD_API_KEY: ${{ secrets.EMAILSHEPHERD_API_KEY }}Every pull request to main is now checked for errors.
Deploy when changes are merged
Section titled “Deploy when changes are merged”Create .github/workflows/deploy.yml:
name: Deploy EDS
on: push: branches: - main
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies run: npm ci - name: Validate EDS run: npx emailshepherd validate env: EMAILSHEPHERD_WORKSPACE_ID: 'your-workspace-id' EMAILSHEPHERD_EDS_ID: 'your-email-design-system-id' EMAILSHEPHERD_API_KEY: ${{ secrets.EMAILSHEPHERD_API_KEY }} - name: Deploy EDS run: npx emailshepherd deploy env: EMAILSHEPHERD_WORKSPACE_ID: 'your-workspace-id' EMAILSHEPHERD_EDS_ID: 'your-email-design-system-id' EMAILSHEPHERD_API_KEY: ${{ secrets.EMAILSHEPHERD_API_KEY }}When changes are merged into main, the EDS is checked again and then deployed. See Deploy your changes for what deploying does.