Skip to content

Commit

Permalink
Sync stage-live to stage-fork (#465)
Browse files Browse the repository at this point in the history
We want to keep the state of `stage-fork` branch the same as the state
of `stage-fork` branch. To achieve that we've added a CI job that
triggers on each push to `stage-live` and pushes the new `stage-live`
changes to `stage-fork`.
  • Loading branch information
jagodarybacka authored Oct 23, 2023
2 parents 8d834dd + 7edf094 commit f1d7e89
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/update-environments.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Refer to docs/testing-env.md to learn more about deployments configuration.
name: Update staging and production environments

on:
push:
branches:
- main
- stage-live
workflow_dispatch:

jobs:
sync-main-to-stage-live:
Expand All @@ -14,28 +16,51 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Open/update a PR from `main` to `stage-live`
id: pull
uses: tretuna/[email protected]
id: pr
uses: tretuna/sync-branches@ea58ab6 # 1.4.0
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: "main"
TO_BRANCH: "stage-live"
PULL_REQUEST_TITLE: "Update stage environments"
PULL_REQUEST_TITLE: "🪄 [QA] Update stage environments"
PULL_REQUEST_BODY: "This is a pull request that upon merging will update stage environments with recent `main` changes."
REVIEWERS: '["andreachapman"]'
- uses: studroid/label-pr-or-issue-action@ff48a93 # v1.0.1
with:
pr-or-issue-number: ${{ steps.pr.outputs.PULL_REQUEST_NUMBER }}
label: "⚙️ deployment"
sync-stage-live-to-stage-fork:
if: github.ref == 'refs/heads/stage-live'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Sync `stage-fork` with `stage-live`
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
git checkout stage-fork
git merge origin/stage-live
git push origin stage-fork
sync-stage-live-to-release:
if: github.ref == 'refs/heads/stage-live'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Open/update a PR from `main` to `stage-live`
id: pull
uses: tretuna/[email protected]
id: pr
uses: tretuna/sync-branches@ea58ab6 # 1.4.0
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: "stage-live"
TO_BRANCH: "release"
PULL_REQUEST_TITLE: "Update release branch"
PULL_REQUEST_TITLE: "🚀 [QA] Update release environment"
PULL_REQUEST_BODY: "This is a pull request that upon merging will update production environment with recent `stage-live` changes."
REVIEWERS: '["andreachapman"]'
- uses: studroid/label-pr-or-issue-action@ff48a93 # v1.0.1
with:
pr-or-issue-number: ${{ steps.pr.outputs.PULL_REQUEST_NUMBER }}
label: "⚙️ deployment"

0 comments on commit f1d7e89

Please sign in to comment.