Skip to content

Commit

Permalink
[39] fix build conflict issues (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 authored and actions-user committed Sep 20, 2024
1 parent 5be6afb commit 7abc3d3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 36 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/increment-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,10 @@ jobs:
old_msg=$(git log -1 HEAD --pretty=format:%s)
version="${value%-build*}"
part_value=$(cat PART)
if [[ "$value" == *"-"* ]]; then
value2="${value#*-build}"
if [[ "$value2" == *"."* ]]; then
build_value="$((${value2%.*} + 1))"
else
build_value="$((${value2} + 1))"
fi
build_value="$((${value#*-build} + 1))"
else
build_value="1"
fi
Expand All @@ -101,9 +98,11 @@ jobs:
echo "commit-short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "$new_value" > "VERSION"
echo "" > "PART"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add VERSION
git add PART
git commit -m "${new_msg}" --amend
git push origin nightly --force-with-lease
Expand Down
29 changes: 10 additions & 19 deletions .github/workflows/validate-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
if: needs.validate-pull.outputs.build == 'true' && (contains(github.event.pull_request.labels.*.name, 'docker') || contains(github.event.pull_request.labels.*.name, 'tester'))
outputs:
commit-msg: ${{ steps.update-version.outputs.commit-msg }}
version: ${{ steps.update-version.outputs.version }}
part_value: ${{ steps.update-version.outputs.part_value }}
tag-name: ${{ steps.update-version.outputs.tag-name }}
extra-text: ${{ steps.update-version.outputs.extra-text }}
steps:
Expand Down Expand Up @@ -106,29 +106,20 @@ jobs:
value=$(cat VERSION)
old_msg=$(git log -1 HEAD --pretty=format:%s)
echo "commit-msg=${old_msg}" >> $GITHUB_OUTPUT
version="${value%-build*}"
if [[ "$value" == *"-"* ]]; then
value2="${value#*-build}"
if [[ "$value2" == *"."* ]]; then
build_value="${value2%.*}"
part_value="$((${value2#*.} + 1))"
else
build_value="${value#*-build}"
part_value="1"
fi
part=$(cat PART)
if [ -n "$part" ]; then
new_value="$((${part} + 1))"
else
build_value="0"
part_value="1"
new_value="1"
fi
new_value="${version}-build${build_value}.${part_value}"
echo "version=${new_value}" >> $GITHUB_OUTPUT
echo "part_value=${new_value}" >> $GITHUB_OUTPUT

echo "$new_value" > "VERSION"
echo "$new_value" > "PART"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add VERSION
git add PART
git commit -m "${tag_name} Part: ${part_value}"
git push

Expand Down Expand Up @@ -233,7 +224,7 @@ jobs:
uses: Kometa-Team/discord-notifications@master
with:
webhook_id_token: ${{ secrets.TESTERS_WEBHOOK }}
message: 'New Commit Pushed to `${{ needs.docker-build-pull.outputs.tag-name }}`: ${{ needs.docker-build-pull.outputs.version }}'
message: 'New Commit Pushed to `${{ needs.docker-build-pull.outputs.tag-name }}`: Part ${{ needs.docker-build-pull.outputs.part_value }}'
title: ${{ github.event.pull_request.title }}
description: ${{ needs.docker-build-pull.outputs.commit-msg }}
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/pull/${{ github.event.number }}
Expand Down
1 change: 1 addition & 0 deletions PART
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2-build38
2.0.2-build39
10 changes: 9 additions & 1 deletion kometa.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ def new_send(*send_args, **kwargs):
local_version = line
break

local_part = ""
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "PART")) as handle:
for line in handle.readlines():
line = line.strip()
if len(line) > 0:
local_part = line
break

uuid_file = os.path.join(default_dir, "UUID")
uuid_num = None
if os.path.exists(uuid_file):
Expand Down Expand Up @@ -265,7 +273,7 @@ def start(attrs):
logger.info_center("| . \\ | `--` | | | | | | |____ | | / _____ \\ ")
logger.info_center("|__|\\__\\ \\______/ |__| |__| |_______| |__| /__/ \\__\\ ")
logger.info("")
my_requests = Requests(local_version, env_branch, git_branch, verify_ssl=False if run_args["no-verify-ssl"] else True)
my_requests = Requests(local_version, local_part, env_branch, git_branch, verify_ssl=False if run_args["no-verify-ssl"] else True)
if is_linuxserver or is_docker:
system_ver = f"{'Linuxserver' if is_linuxserver else 'Docker'}: {env_branch}"
else:
Expand Down
15 changes: 6 additions & 9 deletions modules/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@ def urlparse(data):
return parse.urlparse(str(data))

class Version:
def __init__(self, version_string="Unknown"):
def __init__(self, version_string="Unknown", part_string=""):
self.full = version_string.replace("develop", "build")
version_parts = self.full.split("-build")
self.main = version_parts[0]
self.build = 0
self.part = 0
self.part = int(part_string) if part_string else 0
if len(version_parts) > 1:
sub_parts = str(version_parts[1]).split(".")
self.build = int(sub_parts[0])
if len(sub_parts) > 1:
self.parts = int(sub_parts[1])
self.build = int(version_parts[1])

def __bool__(self):
return self.full != "Unknown"
Expand All @@ -59,11 +56,11 @@ def __repr__(self):
return str(self)

def __str__(self):
return self.full
return f"{self.full}.{self.part}" if self.part else self.full

class Requests:
def __init__(self, local, env_branch, git_branch, verify_ssl=True):
self.local = Version(local)
def __init__(self, local, part, env_branch, git_branch, verify_ssl=True):
self.local = Version(local, part)
self.env_branch = env_branch
self.git_branch = git_branch
self.image_content_types = ["image/png", "image/jpeg", "image/webp"]
Expand Down

0 comments on commit 7abc3d3

Please sign in to comment.