Merge main into Staging #182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to sync main branch changes into staging branch. | |
# Triggered on pushes to main branch. | |
# Jobs: | |
# - CI-preSyncCheck: Runs CI checks on main branch. | |
# - sync-branch: | |
# - Checks out staging branch | |
# - Merges main into staging with --no-ff | |
# - Pushes merged staging branch | |
# Merging with --no-ff creates a merge commit to track changes. | |
name: Sync Main to Staging | |
run-name: Merge main into Staging | |
on: | |
push: | |
branches: ["main"] | |
permissions: # we can tighten this up in settings but are able to set customize permissions against GITHUB_TOKEN in Yaml | |
contents: write | |
actions: write | |
checks: write | |
deployments: write | |
discussions: write | |
issues: write | |
pages: read | |
packages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
jobs: | |
sync-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # fetch all history so we can perform a merge | |
ref: 'staging' | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git push origin staging | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Merge main(dev) -> staging # git merge main --no-ff -> no fast forwarding makes it easier to track changes | |
run: | | |
git checkout main | |
git pull | |
git checkout staging | |
git merge main --no-ff | |
git push origin staging |