mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-20 23:16:57 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae8a961e93 | ||
|
|
e4b5ea3895 | ||
|
|
b61f479180 | ||
|
|
9e6bbd52a6 | ||
|
|
438207a68d |
2
.github/workflows/NightlyRelease.yml
vendored
2
.github/workflows/NightlyRelease.yml
vendored
@@ -304,7 +304,7 @@ jobs:
|
||||
if [[ -n "${downloadedArtifacts[$artifact]}" ]]; then
|
||||
printf " %s\n" "downloading '${artifact}' ... ${ANSI_LIGHT_YELLOW}[SKIPPED]${ANSI_NOCOLOR}"
|
||||
else
|
||||
echo " downloading '${artifact}' ... "
|
||||
printf " downloading '${artifact}' ...\n"
|
||||
printf " %s" "gh run download $GITHUB_RUN_ID --dir \"${artifact}\" --name \"${artifact}\" "
|
||||
gh run download $GITHUB_RUN_ID --dir "${artifact}" --name "${artifact}"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
|
||||
2
.github/workflows/Parameters.yml
vendored
2
.github/workflows/Parameters.yml
vendored
@@ -260,7 +260,7 @@ jobs:
|
||||
|
||||
currentMSYS2Version = "3.12"
|
||||
currentAlphaVersion = "3.14"
|
||||
currentAlphaRelease = "3.14.0-rc.2"
|
||||
currentAlphaRelease = "3.14.0-rc.3"
|
||||
|
||||
if systems == "":
|
||||
print("::error title=Parameter::system_list is empty.")
|
||||
|
||||
74
.github/workflows/PrepareJob.yml
vendored
74
.github/workflows/PrepareJob.yml
vendored
@@ -35,15 +35,18 @@ on:
|
||||
type: string
|
||||
|
||||
outputs:
|
||||
on_default_branch:
|
||||
description: ""
|
||||
value: ${{ jobs.Prepare.outputs.on_default_branch }}
|
||||
on_main_branch:
|
||||
description: ""
|
||||
value: ${{ jobs.Prepare.outputs.on_main_branch }}
|
||||
on_dev_branch:
|
||||
description: ""
|
||||
value: ${{ jobs.Prepare.outputs.on_dev_branch }}
|
||||
on_release_branch:
|
||||
description: ""
|
||||
value: ${{ jobs.Prepare.outputs.on_release_branch }}
|
||||
on_dev_branch:
|
||||
description: ""
|
||||
value: ${{ jobs.Prepare.outputs.on_dev_branch }}
|
||||
is_regular_commit:
|
||||
description: ""
|
||||
value: ${{ jobs.Prepare.outputs.is_regular_commit }}
|
||||
@@ -89,9 +92,10 @@ jobs:
|
||||
name: Extract Information
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
on_default_branch: ${{ steps.Classify.outputs.on_default_branch }}
|
||||
on_main_branch: ${{ steps.Classify.outputs.on_main_branch }}
|
||||
on_dev_branch: ${{ steps.Classify.outputs.on_dev_branch }}
|
||||
on_release_branch: ${{ steps.Classify.outputs.on_release_branch }}
|
||||
on_dev_branch: ${{ steps.Classify.outputs.on_dev_branch }}
|
||||
is_regular_commit: ${{ steps.Classify.outputs.is_regular_commit }}
|
||||
is_merge_commit: ${{ steps.Classify.outputs.is_merge_commit }}
|
||||
is_release_commit: ${{ steps.Classify.outputs.is_release_commit }}
|
||||
@@ -133,15 +137,17 @@ jobs:
|
||||
ANSI_NOCOLOR=$'\x1b[0m'
|
||||
|
||||
ref="${{ github.ref }}"
|
||||
on_default_branch="false"
|
||||
on_main_branch="false"
|
||||
on_dev_branch="false"
|
||||
on_release_branch="false"
|
||||
on_dev_branch="false"
|
||||
is_regular_commit="false"
|
||||
is_merge_commit="false"
|
||||
is_release_commit="false"
|
||||
is_nightly_tag="false"
|
||||
is_release_tag="false"
|
||||
ref_kind="unknown"
|
||||
default_branch=""
|
||||
branch=""
|
||||
tag=""
|
||||
pr_number=""
|
||||
@@ -151,8 +157,29 @@ jobs:
|
||||
ref_kind="branch"
|
||||
branch="${ref:11}"
|
||||
|
||||
printf "Get default branch name ... "
|
||||
defaultBranch=$(gh repo view "${{ github.repository }}" --json defaultBranchRef --jq '.defaultBranchRef.name')
|
||||
if [[ $? -eq 0 ]]; then
|
||||
printf " ${ANSI_LIGHT_GREEN} [OK]\n"
|
||||
else
|
||||
printf " ${ANSI_LIGHT_RED} [FAILED]\n"
|
||||
fi
|
||||
|
||||
printf "Commit check:\n"
|
||||
|
||||
if [[ "${branch}" == "${defaultBranch}" ]]; then
|
||||
on_default_branch="true"
|
||||
|
||||
if [[ -z "$(git rev-list -1 --merges ${{ github.sha }}~1..${{ github.sha }})" ]]; then
|
||||
is_regular_commit="true"
|
||||
printf " ${ANSI_LIGHT_YELLOW}regular "
|
||||
else
|
||||
is_merge_commit="true"
|
||||
printf " ${ANSI_LIGHT_GREEN}merge "
|
||||
fi
|
||||
printf "commit${ANSI_NOCOLOR} on default branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${defaultBranch}"
|
||||
fi
|
||||
|
||||
if [[ "${branch}" == "${{ inputs.main_branch }}" ]]; then
|
||||
on_main_branch="true"
|
||||
|
||||
@@ -166,19 +193,6 @@ jobs:
|
||||
printf "commit${ANSI_NOCOLOR} on main branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.main_branch }}"
|
||||
fi
|
||||
|
||||
if [[ "${branch}" == "${{ inputs.development_branch }}" ]]; then
|
||||
on_dev_branch="true"
|
||||
|
||||
if [[ -z "$(git rev-list -1 --merges ${{ github.sha }}~1..${{ github.sha }})" ]]; then
|
||||
is_regular_commit="true"
|
||||
printf " ${ANSI_LIGHT_YELLOW}regular "
|
||||
else
|
||||
is_merge_commit="true"
|
||||
printf " ${ANSI_LIGHT_GREEN}merge "
|
||||
fi
|
||||
printf "commit${ANSI_NOCOLOR} on development branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.development_branch }}"
|
||||
fi
|
||||
|
||||
if [[ "${branch}" == "${{ inputs.release_branch }}" ]]; then
|
||||
on_release_branch="true"
|
||||
|
||||
@@ -191,20 +205,33 @@ jobs:
|
||||
fi
|
||||
printf "commit${ANSI_NOCOLOR} on release branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.release_branch }}"
|
||||
fi
|
||||
|
||||
if [[ "${branch}" == "${{ inputs.development_branch }}" ]]; then
|
||||
on_dev_branch="true"
|
||||
|
||||
if [[ -z "$(git rev-list -1 --merges ${{ github.sha }}~1..${{ github.sha }})" ]]; then
|
||||
is_regular_commit="true"
|
||||
printf " ${ANSI_LIGHT_YELLOW}regular "
|
||||
else
|
||||
is_merge_commit="true"
|
||||
printf " ${ANSI_LIGHT_GREEN}merge "
|
||||
fi
|
||||
printf "commit${ANSI_NOCOLOR} on development branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.development_branch }}"
|
||||
fi
|
||||
elif [[ "${ref:0:10}" == "refs/tags/" ]]; then
|
||||
ref_kind="tag"
|
||||
tag="${ref:10}"
|
||||
|
||||
printf "Tag check:\n"
|
||||
|
||||
printf " Check if tag is on release branch '%s' ... " "${{ inputs.release_branch }}"
|
||||
git branch --remotes --contains $(git rev-parse --verify "tags/${tag}~0") | grep "origin/${{ inputs.release_branch }}" > /dev/null
|
||||
printf " Check if tag is on main branch '%s' ... " "${{ inputs.main_branch }}"
|
||||
git branch --remotes --contains $(git rev-parse --verify "tags/${tag}~0") | grep "origin/${{ inputs.main_branch }}" > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
printf "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}\n"
|
||||
else
|
||||
printf "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}\n"
|
||||
printf "${ANSI_LIGHT_RED}Tag '%s' isn't on branch '%s'.${ANSI_NOCOLOR}\n" "${tag}" "${{ inputs.release_branch }}"
|
||||
printf "::error title=TagCheck::Tag '%s' isn't on branch '%s'.\n" "${tag}" "${{ inputs.release_branch }}"
|
||||
printf "${ANSI_LIGHT_RED}Tag '%s' isn't on branch '%s'.${ANSI_NOCOLOR}\n" "${tag}" "${{ inputs.main_branch }}"
|
||||
printf "::error title=TagCheck::Tag '%s' isn't on branch '%s'.\n" "${tag}" "${{ inputs.main_branch }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -240,9 +267,10 @@ jobs:
|
||||
fi
|
||||
|
||||
tee --append "${GITHUB_OUTPUT}" <<EOF
|
||||
on_default_branch=${on_default_branch}
|
||||
on_main_branch=${on_main_branch}
|
||||
on_dev_branch=${on_dev_branch}
|
||||
on_release_branch=${on_release_branch}
|
||||
on_dev_branch=${on_dev_branch}
|
||||
is_regular_commit=${is_regular_commit}
|
||||
is_merge_commit=${is_merge_commit}
|
||||
is_release_commit=${is_release_commit}
|
||||
|
||||
38
.github/workflows/PublishReleaseNotes.yml
vendored
38
.github/workflows/PublishReleaseNotes.yml
vendored
@@ -249,7 +249,7 @@ jobs:
|
||||
printf " %s\n" "MergedAt: ${PR_MERGED_AT} ($(date -d"${PR_MERGED_AT}" '+%d.%m.%Y - %H:%M:%S'))"
|
||||
fi
|
||||
|
||||
echo "${PR_BODY}" > __PULLREQUEST__.md
|
||||
printf "%s\n" "${PR_BODY}" > __PULLREQUEST__.md
|
||||
fi
|
||||
|
||||
# Check if a release description file should be used and exists.
|
||||
@@ -353,7 +353,7 @@ jobs:
|
||||
NOTES="${NOTES//%%datetime%%/$(date '+%Y-%m-%d %H:%M:%S %Z')}"
|
||||
|
||||
# Write final release notes to file
|
||||
echo "${NOTES}" > __NOTES__.md
|
||||
printf "%s\n" "${NOTES}" > __NOTES__.md
|
||||
|
||||
# Display partial contents for debugging
|
||||
if [[ -s __DESCRIPTION__.md ]]; then
|
||||
@@ -496,7 +496,26 @@ jobs:
|
||||
|
||||
# Create JSON inventory
|
||||
if [[ "${{ inputs.inventory-json }}" != "" ]]; then
|
||||
VERSION="1.0"
|
||||
STRUCT_VERSION="1.1"
|
||||
|
||||
# Use GitHub API to ask for latest version
|
||||
printf "Get latest released version via GitHub API ...\n"
|
||||
printf " gh release list --json tagName,isLatest --jq '.[] | select(.isLatest == true) | .tagName' "
|
||||
latestVersion=$(gh release list --json tagName,isLatest --jq '.[] | select(.isLatest == true) | .tagName')
|
||||
if [[ $? -eq 0 ]]; then
|
||||
if [[ -z "${latestVersion}" ]]; then
|
||||
printf "${ANSI_LIGHT_RED}[UNKNOWN]${ANSI_NOCOLOR}\n"
|
||||
latestVersion="unknown"
|
||||
else
|
||||
printf "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}\n"
|
||||
fi
|
||||
else
|
||||
printf "${ANSI_LIGHT_RED}[ERROR]${ANSI_NOCOLOR}\n"
|
||||
printf " ${ANSI_LIGHT_RED}Couldn't get latest released version '%s'.${ANSI_NOCOLOR}\n" "${latestVersion}"
|
||||
printf "::error title=%s::%s\n" "GitHub Release API" "Couldn't get latest released version '${latestVersion}'."
|
||||
|
||||
latestVersion="error"
|
||||
fi
|
||||
|
||||
# Split categories by ',' into a Bash array.
|
||||
# See https://stackoverflow.com/a/45201229/3719459
|
||||
@@ -509,7 +528,7 @@ jobs:
|
||||
fi
|
||||
|
||||
jsonInventory=$(jq -c -n \
|
||||
--arg version "${VERSION}" \
|
||||
--arg structVersion "${STRUCT_VERSION}" \
|
||||
--arg date "$(date +"%Y-%m-%dT%H-%M-%S%:z")" \
|
||||
--argjson jsonMeta "$(jq -c -n \
|
||||
--arg tag "${{ inputs.tag }}" \
|
||||
@@ -517,13 +536,18 @@ jobs:
|
||||
--arg hash "${{ github.sha }}" \
|
||||
--arg repo "${{ github.server_url }}/${{ github.repository }}" \
|
||||
--arg release "${{ github.server_url }}/${{ github.repository }}/releases/download/${{ inputs.tag }}" \
|
||||
--argjson jsonLatest "$(jq -c -n \
|
||||
--arg version "${latestVersion}" \
|
||||
--arg release "${{ github.server_url }}/${{ github.repository }}/releases/download/${latestVersion}" \
|
||||
'{"version": $version, "release-url": $release}' \
|
||||
)" \
|
||||
--argjson categories "$(jq -c -n \
|
||||
'$ARGS.positional' \
|
||||
--args "${inventoryCategories[@]}" \
|
||||
)" \
|
||||
'{"tag": $tag, "version": $version, "git-hash": $hash, "repository-url": $repo, "release-url": $release, "categories": $categories}' \
|
||||
'{"tag": $tag, "version": $version, "git-hash": $hash, "repository-url": $repo, "release-url": $release, "categories": $categories, "latest": $jsonLatest}' \
|
||||
)" \
|
||||
'{"version": 1.0, "timestamp": $date, "meta": $jsonMeta, "files": {}}'
|
||||
'{"version": $structVersion, "timestamp": $date, "meta": $jsonMeta, "files": {}}'
|
||||
)
|
||||
fi
|
||||
|
||||
@@ -577,7 +601,7 @@ jobs:
|
||||
if [[ -n "${downloadedArtifacts[$artifact]}" ]]; then
|
||||
printf " downloading artifact '%s' ... ${ANSI_LIGHT_YELLOW}[SKIPPED]${ANSI_NOCOLOR}\n" "${artifact}"
|
||||
else
|
||||
echo " downloading '${artifact}' ... "
|
||||
printf " downloading '${artifact}' ...\n"
|
||||
printf " gh run download $GITHUB_RUN_ID --dir \"%s\" --name \"%s\" " "${artifact}" "${artifact}"
|
||||
gh run download $GITHUB_RUN_ID --dir "${artifact}" --name "${artifact}"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user