[39] fix build conflict issues (#2230)

This commit is contained in:
meisnate12 2024-09-20 13:18:37 -04:00 committed by GitHub Action
parent 5be6afb8bc
commit 7abc3d3c1d
6 changed files with 32 additions and 36 deletions

View file

@ -80,13 +80,10 @@ jobs:
old_msg=$(git log -1 HEAD --pretty=format:%s) old_msg=$(git log -1 HEAD --pretty=format:%s)
version="${value%-build*}" version="${value%-build*}"
part_value=$(cat PART)
if [[ "$value" == *"-"* ]]; then if [[ "$value" == *"-"* ]]; then
value2="${value#*-build}" build_value="$((${value#*-build} + 1))"
if [[ "$value2" == *"."* ]]; then
build_value="$((${value2%.*} + 1))"
else
build_value="$((${value2} + 1))"
fi
else else
build_value="1" build_value="1"
fi fi
@ -101,9 +98,11 @@ jobs:
echo "commit-short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT echo "commit-short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "$new_value" > "VERSION" echo "$new_value" > "VERSION"
echo "" > "PART"
git config --local user.email "action@github.com" git config --local user.email "action@github.com"
git config --local user.name "GitHub Action" git config --local user.name "GitHub Action"
git add VERSION git add VERSION
git add PART
git commit -m "${new_msg}" --amend git commit -m "${new_msg}" --amend
git push origin nightly --force-with-lease git push origin nightly --force-with-lease

View file

@ -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')) if: needs.validate-pull.outputs.build == 'true' && (contains(github.event.pull_request.labels.*.name, 'docker') || contains(github.event.pull_request.labels.*.name, 'tester'))
outputs: outputs:
commit-msg: ${{ steps.update-version.outputs.commit-msg }} 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 }} tag-name: ${{ steps.update-version.outputs.tag-name }}
extra-text: ${{ steps.update-version.outputs.extra-text }} extra-text: ${{ steps.update-version.outputs.extra-text }}
steps: steps:
@ -106,29 +106,20 @@ jobs:
value=$(cat VERSION) value=$(cat VERSION)
old_msg=$(git log -1 HEAD --pretty=format:%s) old_msg=$(git log -1 HEAD --pretty=format:%s)
echo "commit-msg=${old_msg}" >> $GITHUB_OUTPUT echo "commit-msg=${old_msg}" >> $GITHUB_OUTPUT
version="${value%-build*}"
if [[ "$value" == *"-"* ]]; then part=$(cat PART)
value2="${value#*-build}" if [ -n "$part" ]; then
if [[ "$value2" == *"."* ]]; then new_value="$((${part} + 1))"
build_value="${value2%.*}"
part_value="$((${value2#*.} + 1))"
else else
build_value="${value#*-build}" new_value="1"
part_value="1"
fi
else
build_value="0"
part_value="1"
fi fi
new_value="${version}-build${build_value}.${part_value}" echo "part_value=${new_value}" >> $GITHUB_OUTPUT
echo "version=${new_value}" >> $GITHUB_OUTPUT
echo "$new_value" > "VERSION" echo "$new_value" > "PART"
git config --local user.email "action@github.com" git config --local user.email "action@github.com"
git config --local user.name "GitHub Action" git config --local user.name "GitHub Action"
git add VERSION git add PART
git commit -m "${tag_name} Part: ${part_value}" git commit -m "${tag_name} Part: ${part_value}"
git push git push
@ -233,7 +224,7 @@ jobs:
uses: Kometa-Team/discord-notifications@master uses: Kometa-Team/discord-notifications@master
with: with:
webhook_id_token: ${{ secrets.TESTERS_WEBHOOK }} 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 }} title: ${{ github.event.pull_request.title }}
description: ${{ needs.docker-build-pull.outputs.commit-msg }} description: ${{ needs.docker-build-pull.outputs.commit-msg }}
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/pull/${{ github.event.number }} url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/pull/${{ github.event.number }}

1
PART Normal file
View file

@ -0,0 +1 @@

View file

@ -1 +1 @@
2.0.2-build38 2.0.2-build39

View file

@ -232,6 +232,14 @@ with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")) a
local_version = line local_version = line
break 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_file = os.path.join(default_dir, "UUID")
uuid_num = None uuid_num = None
if os.path.exists(uuid_file): if os.path.exists(uuid_file):
@ -265,7 +273,7 @@ def start(attrs):
logger.info_center("| . \\ | `--` | | | | | | |____ | | / _____ \\ ") logger.info_center("| . \\ | `--` | | | | | | |____ | | / _____ \\ ")
logger.info_center("|__|\\__\\ \\______/ |__| |__| |_______| |__| /__/ \\__\\ ") logger.info_center("|__|\\__\\ \\______/ |__| |__| |_______| |__| /__/ \\__\\ ")
logger.info("") 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: if is_linuxserver or is_docker:
system_ver = f"{'Linuxserver' if is_linuxserver else 'Docker'}: {env_branch}" system_ver = f"{'Linuxserver' if is_linuxserver else 'Docker'}: {env_branch}"
else: else:

View file

@ -40,17 +40,14 @@ def urlparse(data):
return parse.urlparse(str(data)) return parse.urlparse(str(data))
class Version: class Version:
def __init__(self, version_string="Unknown"): def __init__(self, version_string="Unknown", part_string=""):
self.full = version_string.replace("develop", "build") self.full = version_string.replace("develop", "build")
version_parts = self.full.split("-build") version_parts = self.full.split("-build")
self.main = version_parts[0] self.main = version_parts[0]
self.build = 0 self.build = 0
self.part = 0 self.part = int(part_string) if part_string else 0
if len(version_parts) > 1: if len(version_parts) > 1:
sub_parts = str(version_parts[1]).split(".") self.build = int(version_parts[1])
self.build = int(sub_parts[0])
if len(sub_parts) > 1:
self.parts = int(sub_parts[1])
def __bool__(self): def __bool__(self):
return self.full != "Unknown" return self.full != "Unknown"
@ -59,11 +56,11 @@ class Version:
return str(self) return str(self)
def __str__(self): def __str__(self):
return self.full return f"{self.full}.{self.part}" if self.part else self.full
class Requests: class Requests:
def __init__(self, local, env_branch, git_branch, verify_ssl=True): def __init__(self, local, part, env_branch, git_branch, verify_ssl=True):
self.local = Version(local) self.local = Version(local, part)
self.env_branch = env_branch self.env_branch = env_branch
self.git_branch = git_branch self.git_branch = git_branch
self.image_content_types = ["image/png", "image/jpeg", "image/webp"] self.image_content_types = ["image/png", "image/jpeg", "image/webp"]