Skip to content

build: bump typescript #128

build: bump typescript

build: bump typescript #128

Workflow file for this run

name: Sync branches
on:
push:
branches:
- main
workflow_dispatch:
inputs:
source:
description: Source ref (branch or sha)
required: true
type: string
target:
description: Target branch
required: true
type: choice
options:
- production
- stage-stable
jobs:
check:
name: Validate source and target refs
timeout-minutes: 1
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.source }}
fetch-depth: 0
- name: Check ancestry
if: ${{ github.event.inputs.target == 'production' }}
run: |
if ! git merge-base --is-ancestor ${{ github.event.inputs.source }} origin/main; then
echo "Target is production and source ref isn't an ancestor of main"
exit 1
fi
if ! git merge-base --is-ancestor ${{ github.event.inputs.source }} origin/stage-stable; then
echo "Target is production and source ref isn't deployed in stage-stable"
echo "The main and stage-stable branches should be in sync, please fix"
exit 1
fi
- name: Check stage-stable manual sync
if: ${{ github.event.inputs.target == 'stage-stable' }}
run: |
if [ $(git rev-parse ${{ github.event.inputs.source }}) != $(git rev-parse origin/main) ]; then
echo "Target is stage-stable and source ref isn't main"
exit 1
fi
sync:
name: Sync source and target refs
needs: check
if: ${{ github.event_name == 'push' || success() }}
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.FE_RELEASE_TOKEN }}
ref: ${{ (github.event.inputs.target == 'production' && github.event.inputs.source) || 'main' }}
fetch-depth: 0
- name: Release to production
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'production' }}
run: |
git push https://${GITHUB_ACTOR}:${{ secrets.FE_RELEASE_TOKEN }}@github.com/${{ github.repository }}.git HEAD:prod-beta
git push https://${GITHUB_ACTOR}:${{ secrets.FE_RELEASE_TOKEN }}@github.com/${{ github.repository }}.git HEAD:prod-stable
- name: Sync main to stage-stable
if: ${{ github.event_name == 'push' || github.event.inputs.target == 'stage-stable' }}
run:
git push https://${GITHUB_ACTOR}:${{ secrets.FE_RELEASE_TOKEN }}@github.com/${{ github.repository }}.git HEAD:stage-stable