Stage to PROD Code Sync #19
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
name: Stage to PROD Code Sync | |
on: | |
workflow_dispatch: | |
inputs: | |
syncNow: | |
description: 'Sync Now' | |
required: false | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout prod repository | |
uses: actions/checkout@v2 | |
with: | |
repository: pricefx/pricefx-eds-prod | |
token: ${{ secrets.GIT_PERSONAL_ACCESS_TOKEN }} | |
ref: main | |
- name: Configure Git identity | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Github Actions" | |
- name: Fetch latest changes from pricefx-eds-stage | |
run: | | |
git remote add pricefx-eds-stage https://github.com/pricefx/pricefx-eds-stage || true | |
git fetch pricefx-eds-stage main:pricefx-eds-stage-main | |
- name: Merge changes excluding fstab.yaml and robots.txt | |
run: | | |
git merge --no-commit --no-ff --allow-unrelated-histories pricefx-eds-stage-main || true | |
git checkout --theirs . || true | |
git reset HEAD fstab.yaml robots.txt | |
git checkout -- fstab.yaml robots.txt | |
git add . | |
git commit -m "Sync main branch from pricefx-eds-stage, excluding fstab.yaml and robots.txt" | |
- name: Push changes to pricefx-eds-prod | |
run: | | |
git push https://github.com/pricefx/pricefx-eds-prod HEAD:main | |
env: | |
GIT_PERSONAL_ACCESS_TOKEN: ${{ secrets.GIT_PERSONAL_ACCESS_TOKEN }} |