Backpack Site Builder
Optional Guides
GitHub Actions

Github actions

We use several github actions depending on project needs. The following actions are available:

  • Keep components in sync from code to storyblok
  • Sync all content from production space to develop/staging/qa space (destructive operation)

Sync all components on push to master

With this action, you can keep your components in sync from code to storyblok. This action will create/update components in storyblok based on the components in your code by leveraging sb-mig. This action will only run on push to master.

Usage


_34
name: Sync components
_34
on:
_34
push:
_34
branches:
_34
- master
_34
_34
jobs:
_34
release:
_34
name: sb-mig sync
_34
runs-on: ubuntu-latest
_34
environment: production
_34
env:
_34
GH_PACKAGES_TOKEN: ${{ secrets.EF_GLOBAL_RELEASE_PACKAGES_TOKEN }}
_34
STORYBLOK_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_STORYBLOK_ACCESS_TOKEN }}
_34
STORYBLOK_OAUTH_TOKEN: ${{ secrets.STORYBLOK_OAUTH_TOKEN }}
_34
STORYBLOK_SPACE_ID: ${{ vars.PROD_STORYBLOK_SPACE_ID }}
_34
_34
steps:
_34
- name: Checkout
_34
uses: actions/checkout@v3
_34
with:
_34
fetch-depth: 0
_34
_34
- name: Use Node.js 18.x
_34
uses: actions/setup-node@v3
_34
with:
_34
node-version: 18.x
_34
_34
- name: Install dependencies
_34
run: yarn
_34
_34
- name: Sync components
_34
run: |
_34
yarn sb-mig sync components --all

Sync all content from production space to develop/staging/qa space

This action syncs all content from production space to develop/staging/qa space. This action runs on a cron that can be customized. It is a destructive operation, so it will delete all content in the target space before syncing.

Usage


_32
name: Sync Production to Develop
_32
on:
_32
schedule:
_32
- cron: '0 9 * * 1' # Every Monday at 9am UTC
_32
_32
jobs:
_32
sync_content_prod_to_dev:
_32
name: Sync content from prod to dev
_32
runs-on: ubuntu-latest
_32
_32
env:
_32
PROD_STORYBLOK_SPACE_ID: ${{ vars.PROD_STORYBLOK_SPACE_ID }}
_32
STORYBLOK_OAUTH_TOKEN: ${{ secrets.STORYBLOK_OAUTH_TOKEN }}
_32
DEV_STORYBLOK_SPACE_ID: ${{ vars.DEV_STORYBLOK_SPACE_ID }}
_32
GH_PACKAGES_TOKEN: ${{ secrets.EF_GLOBAL_RELEASE_PACKAGES_TOKEN }}
_32
_32
steps:
_32
- name: Checkout
_32
uses: actions/checkout@v3
_32
with:
_32
fetch-depth: 0
_32
_32
- name: Use Node.js 18.x
_32
uses: actions/setup-node@v3
_32
with:
_32
node-version: 18.x
_32
_32
- name: Install dependencies
_32
run: yarn
_32
- name: Sync content from prod to dev
_32
run: |
_32
yarn sb-mig sync content --stories --from=${PROD_STORYBLOK_SPACE_ID} --to=${DEV_STORYBLOK_SPACE_ID} --yes