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
_34name: Sync components_34on:_34 push:_34 branches:_34 - master_34_34jobs:_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
_32name: Sync Production to Develop_32on:_32 schedule:_32 - cron: '0 9 * * 1' # Every Monday at 9am UTC_32_32jobs:_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