Skip to content

Sync Develop

Reusable workflow to sync the develop branch after a release on main. Merges main into develop to keep the development branch up-to-date with released code.

Trigger

yaml
on:
  workflow_call:

Called after Release Please when release_created == 'true'.

Inputs

No inputs are required.

Secrets

No additional secrets are required. The workflow uses the default GITHUB_TOKEN via permissions.

Permissions

yaml
permissions:
  contents: write

Required to push to the develop branch.

Job: sync

Runs on ubuntu-latest:

  1. Checkout the develop branch with fetch-depth: 0 (full history).
  2. Configure Git with the github-actions[bot] user.
  3. Merge origin/main into develop (git merge origin/main --no-edit).
  4. Push the updated develop branch.

When to use

This workflow should be called as part of the release pipeline, after Release Please creates a new release:

Release Please creates tag

        ├── post-release (build ZIP, upload)

        └── sync-develop (merge main → develop)

Usage example

yaml
# .github/workflows/release.yml
name: Release

on:
  push:
    branches: [main]

jobs:
  release-please:
    uses: middag-io/.github-private/.github/workflows/release-please.yml@workflows-v1

  sync-develop:
    needs: release-please
    if: needs.release-please.outputs.release_created == 'true'
    uses: middag-io/.github-private/.github/workflows/sync-develop.yml@workflows-v1

Conflict resolution

If there are conflicts between main and develop, the merge will fail and the workflow will report an error. In that case, resolve the conflicts manually:

bash
git checkout develop
git pull origin develop
git merge origin/main
# resolve conflicts
git push origin develop

MIDDAG Tecnologia