Skip to content

Merge pull request #94 from thomasKn/chore #100

Merge pull request #94 from thomasKn/chore

Merge pull request #94 from thomasKn/chore #100

###############
# This Workflow is used to mirror the main branch to a preview branch.
# Each time the main branch is updated, the preview branch will be updated.
# Useful for having a fixed preview URL that can be used by Sanity Studio.
# The SANITY_STUDIO_USE_STEGA environment variable should be set to true for the preview branch.
# Github Worflow permissions should be set to Read and write => https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions
# If using Vercel, the Vercel Authentication setting should be disabled => https://vercel.com/docs/security/deployment-protection/methods-to-protect-deployments/vercel-authentication#managing-vercel-authentication
###############
name: Sanity Preview Branch
on:
push:
branches:
- main
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Fetch latest changes
run: git fetch origin main
- name: Push to Mirror Branch
run: |
git checkout -b preview
git push --force origin preview
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}