Skip to content

Commit

Permalink
docs(DEVELOPMENT): added instruction about conflict resolution (#9)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <[email protected]>
Co-authored-by: Krzysztof Słonka <[email protected]>
  • Loading branch information
2 people authored and github-actions[bot] committed Dec 11, 2024
1 parent b6f3986 commit e75448b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 4 deletions.
17 changes: 13 additions & 4 deletions .github/scripts/get-version-tags.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

current_tag=$(git tag --list --merged origin/release --sort=-creatordate | head -n 1)
main_tag=$(git tag --list --merged main --sort=-creatordate | head -n 1)
main_tag=$(git tag --list --merged origin/main --sort=-creatordate | head -n 1)

# Remove the prefix `v` and `-kong-*` suffix for comparison
released_tag="${current_tag%-kong-*}"
Expand All @@ -10,6 +10,16 @@ currentVersion="${released_tag#v}"
# Main branch won't have -kong-* suffix
newVersion="${main_tag#v}"

echo "Current release tag prefix: $released_tag"
echo "Upstream tag: $main_tag"
new_tag="${main_tag}-kong-1"
if [[ $current_tag != $new_tag ]]; then
echo "New tag: $new_tag"
else
echo "Tags are equal, no need to release"
exit 0
fi

# Convert versions to arrays
IFS='.' read -r -a currentParts <<< "$currentVersion"
IFS='.' read -r -a newParts <<< "$newVersion"
Expand All @@ -24,9 +34,8 @@ echo "Upstream tag: $newVersion"
for i in 0 1 2; do
if [[ ${newParts[i]:-0} -gt ${currentParts[i]:-0} ]]; then
echo "The new tag is higher."
newVersionTag="${main_tag}-kong-1"
echo "New version tag: $newVersionTag"
echo "new_tag=$newVersionTag" >> $GITHUB_OUTPUT
echo "New version tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
exit 0
elif [[ ${newParts[i]:-0} -lt ${currentParts[i]:-0} ]]; then
echo "The current tag is higher. That shouldn't be that case, please fix tagging."
Expand Down
55 changes: 55 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,58 @@ The current tag is `v0.13.1-kong-1`. After merging your changes, you want to rel
`v0.13.1-kong-2`

After tagging, push the commit to the repository to finalize the release.

## Conflict resolution

It might happen that automatic release job can hit a conflict. In this situation maintainer needs to resolve this manually:

Instruction

1. Fetch current `main` and `release` branch
```bash
git fetch origin --tags
```
2. Update current main branch with origin
```bash
git reset --hard origin/main
```
3. Change to the release branch
```bash
git checkout release
git reset --hard origin/release
```
4. Remove Untracked Files and Directories
```bash
git clean -fd
```
5. Get new tag value
```bash
./.github/scripts/get-version-tags.sh
```

Output:
```bash
Current release tag prefix: v0.13.1
Upstream tag: v0.13.2
New tag: v0.13.2-kong-1
```

if tags are equal, you are going to see message `"Tags are equal, no need to release"` and you don't need to release/rebase anything.

6. Rebase release branch between tags:
```bash
git rebase --onto <Upstream tag> <Current release tag prefix> release
```
7. If you encounter git conflicts, resolve them, and follow git instruction
* resolve conflicts
* git add <files>
* git rebase --continue

8. Tag the commit
```bash
git tag <New tag>
```
9. Push changes to origin
```bash
git push origin release --tags --force-with-lease
```

0 comments on commit e75448b

Please sign in to comment.