mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-04-10 19:15:12 +00:00
refactor: update version extraction logic to include build ID and streamline version fetching
This commit is contained in:
parent
8be9782ff7
commit
1cdf81aab0
14
.github/workflows/build_retrodeck.yml
vendored
14
.github/workflows/build_retrodeck.yml
vendored
|
|
@ -106,20 +106,20 @@ jobs:
|
||||||
- name: Generate Version Tag
|
- name: Generate Version Tag
|
||||||
id: version-tag
|
id: version-tag
|
||||||
run: |
|
run: |
|
||||||
# Source the version extractor script and fetch the manifest version
|
# Source the version extractor script and fetch the actual version, including the build ID
|
||||||
source automation_tools/version_extractor.sh
|
source automation_tools/version_extractor.sh
|
||||||
MANIFEST_VERSION="$(fetch_manifest_version)"
|
VERSION="$(fetch_actual_version)"
|
||||||
|
|
||||||
# Ensure the manifest version was successfully extracted
|
# Ensure the actual version was successfully extracted
|
||||||
if [[ -z "$MANIFEST_VERSION" ]]; then
|
if [[ -z "$VERSION" ]]; then
|
||||||
echo "[ERROR] Failed to extract the manifest version."
|
echo "[ERROR] Failed to extract the actual version."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine the tag based on the GitHub event context
|
# Determine the tag based on the GitHub event context
|
||||||
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
|
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
|
||||||
# Main branch tag
|
# Main branch tag
|
||||||
TAG="$MANIFEST_VERSION"
|
TAG="$VERSION"
|
||||||
MAKE_LATEST=true
|
MAKE_LATEST=true
|
||||||
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
|
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
|
||||||
# Pull request tag, sanitize the source branch
|
# Pull request tag, sanitize the source branch
|
||||||
|
|
@ -128,7 +128,7 @@ jobs:
|
||||||
MAKE_LATEST=false
|
MAKE_LATEST=false
|
||||||
else
|
else
|
||||||
# Other branches (cooker branches)
|
# Other branches (cooker branches)
|
||||||
TAG="$MANIFEST_VERSION-${{ env.BUILD_ID }}"
|
TAG="$VERSION-${{ env.BUILD_ID }}"
|
||||||
MAKE_LATEST=true
|
MAKE_LATEST=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,16 @@ fetch_metainfo_version(){
|
||||||
echo "$VERSION"
|
echo "$VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: cooker_build_id logic can be moved here
|
||||||
|
|
||||||
|
fetch_actual_version(){
|
||||||
|
# If the current Git branch is not 'main', append 'cooker-' to the version number
|
||||||
|
if [[ "${GITHUB_REF_NAME}" != "main" ]]; then
|
||||||
|
VERSION="cooker-$(cat ./version)-$(cat buildid)"
|
||||||
|
else # Otherwise, if we're on main, use the version number as is
|
||||||
|
VERSION=$(cat ./version)
|
||||||
|
fi
|
||||||
|
echo "$VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
echo "Version extractor functions loaded"
|
echo "Version extractor functions loaded"
|
||||||
|
|
@ -83,12 +83,8 @@ modules:
|
||||||
- |
|
- |
|
||||||
|
|
||||||
# VERSION INITIALIZATION
|
# VERSION INITIALIZATION
|
||||||
# If the current Git branch is not 'main', append 'cooker-' to the version number
|
source "automation_tools/version_extractor.sh"
|
||||||
if [[ "${GITHUB_REF_NAME}" != "main" ]]; then
|
VERSION=$(fetch_actual_version)
|
||||||
VERSION="cooker-$(cat ./version)-$(cat buildid)"
|
|
||||||
else # Otherwise, if we're on main, use the version number as is
|
|
||||||
VERSION=$(cat ./version)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check out the current Git branch
|
# Check out the current Git branch
|
||||||
git checkout ${GITHUB_REF_NAME}
|
git checkout ${GITHUB_REF_NAME}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue