Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ on:

permissions: read-all

# A release dispatches a tag-carrying sync while the push to main triggers a
# second, tag-less sync. Serialize them so they don't race on the commit to main
# and the tag-carrying run tags the already-synced commit.
concurrency:
group: sync-api
cancel-in-progress: false

jobs:
sync:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -73,3 +80,18 @@ jobs:
access_token: ${{ secrets.REPO_PAT }}
branch: main
enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }}

# When the sync is triggered by a release, the cloudnative-pg release-tag
# workflow passes the release tag in the dispatch payload. Tag the freshly
# synced commit so the API repository keeps the same tags as cloudnative-pg.
- name: Tag the synced release
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag != '' }}
env:
TAG: ${{ github.event.client_payload.tag }}
run: |
if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q .; then
echo "Tag ${TAG} already exists, nothing to do."
exit 0
fi
git tag "${TAG}"
git push origin "${TAG}"