diff --git a/.github/workflows/sync-branches.yml b/.github/workflows/sync-branches.yml deleted file mode 100644 index e2fdf95d..00000000 --- a/.github/workflows/sync-branches.yml +++ /dev/null @@ -1,79 +0,0 @@ -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: - ref: ${{ github.event.inputs.source }} - fetch-depth: 0 - - - name: Release to production - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'production' }} - run: | - git push https://${{ secrets.SCHUTZBOT_GH_TOKEN }}@github.com/${{ github.repository }}.git ${{ github.event.inputs.source }}:refs/heads/prod-beta - git push https://${{ secrets.SCHUTZBOT_GH_TOKEN }}@github.com/${{ github.repository }}.git ${{ github.event.inputs.source }}:refs/heads/prod-stable - - - name: Sync main to stage-stable - if: ${{ github.event_name == 'push' || github.event.inputs.target == 'stage-stable' }} - run: | - git push https://${{ secrets.SCHUTZBOT_GH_TOKEN }}@github.com/${{ github.repository }}.git origin/main:refs/heads/stage-stable