Skip to content

Commit

Permalink
root: added DOTNET's nupkg implementations
Browse files Browse the repository at this point in the history
Since DOTNET's nupkg is quite simple to create and to upstream,
it's best we support it from the start. Besides, the Chocolatey
is one of the nupkg implementations so no worries.

This patch adds DOTNET's nupkg implementations in root
repository.

Co-authored-by: Shuralyov, Jean <[email protected]>
Co-authored-by: Galyna, Cory <[email protected]>
Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]>
Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
  • Loading branch information
3 people committed Jun 22, 2024
1 parent 288912c commit f159527
Show file tree
Hide file tree
Showing 72 changed files with 3,882 additions and 125 deletions.
56 changes: 46 additions & 10 deletions CONFIG.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,15 @@ PROJECT_BOOK = 'srcBOOK'
PROJECT_C = 'srcC'


# PROJECT_C_BRANCH_TAG
# PROJECT_C_ID
# This is for technology tagging purposes such as but not limited to release
# branches identification. The value shall always be lowercase, short, and
# directly identify it is C technology.
# directly identify as a C-based technology.
#
# This field shall not be EMPTY.
#
# Default is: 'c'
# To disable: set it empty ''
PROJECT_C_BRANCH_TAG = 'c'
PROJECT_C_ID = 'c'



Expand Down Expand Up @@ -628,14 +629,15 @@ PROJECT_NODE_VERSION = 'v22.2.0'
PROJECT_NODE_NPM_REGISTRY = 'https://npm.pkg.github.com'


# PROJECT_NODE_BRANCH_TAG
# PROJECT_NODE_NPM_ID
# This is for technology tagging purposes such as but not limited to release
# branches identification. The value shall always be lowercase, short, and
# directly identify it is Node technology.
# directly identify as a Node NPM technology.
#
# This field shall not be EMPTY.
#
# Default is: 'npm'
# To disable: set it empty ''
PROJECT_NODE_BRANCH_TAG = 'npm'
PROJECT_NODE_NPM_ID = 'npm'



Expand Down Expand Up @@ -888,15 +890,25 @@ PROJECT_RELEASE_IPK = 'enabled'
PROJECT_CHOCOLATEY_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest/download'




# PROJECT_CHOCOLATEY_VERSION
# The Chocolatey version as a dependency. This field SHALL NOT BE EMPTY.
#
# Default value is: '0.9.8.21'
PROJECT_CHOCOLATEY_VERSION = '0.9.8.21'


# PROJECT_CHOCOLATEY_ID
# This is for technology tagging purposes such as but not limited to release
# branches identification. The value shall always be lowercase, short, and
# directly identify as Chocolatey technology (including away from the original
# DOTNET nupkg).
#
# This field shall not be EMPTY.
#
# Default is: 'chocolatey'
PROJECT_CHOCOLATEY_ID = 'chocolatey'




#############################
Expand Down Expand Up @@ -1664,6 +1676,30 @@ PROJECT_MSI_DOCS_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039404'



##########################
# DISTRIBUTION - NUPKG #
##########################
# PROJECT_NUPKG_URL
# The registry url for publishing the DOTNET .nupkg package file. More info:
# (1) https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
# (2) https://learn.microsoft.com/en-us/nuget/api/package-publish-resource
# (3) https://learn.microsoft.com/en-us/nuget/api/overview
#
# Some examples:
# (1) GitHub Package: 'https://nuget.pkg.github.com/[USERNAME]'
# (2) Nuget.org : 'https://www.nuget.org/api/v2/package'
#
# This field also acts as the flag for enabling or disabling the nupkg pipeline.
#
# To enable : fill in the end-user downloadable URL without ending slash.
# To disable: leave this field empty ('').
#
# !! IMPORTANT !! - Please avoid ending with the URL slash.
PROJECT_NUPKG_URL = 'https://nuget.pkg.github.com/ChewKeanHo'




##########################
# DISTRIBUTION - RPM #
##########################
Expand Down
11 changes: 11 additions & 0 deletions automataCI/SECRETS-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ NPM_TOKEN = ""



######################
# NUPKG TECHNOLOGY #
######################
# NUPKG_TOKEN
# The Authentication token (e.g. 'Authentication: ' or 'X-NuGet-ApiKey: ') for
# logging into the corresponding NUPKG registry defined in the CONFIG.toml.
NUPKG_TOKEN = ""




######################
# PYTHON TECHNOLOGY #
######################
Expand Down
34 changes: 22 additions & 12 deletions automataCI/_package-chocolatey_unix-any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ PACKAGE_Run_CHOCOLATEY() {

# prepare workspace and required values
I18N_Create_Package "CHOCOLATEY"
_src="${_target_filename}_${PROJECT_VERSION}_${_target_os}-${_target_arch}"
_src="${PROJECT_CHOCOLATEY_ID}-${_target_filename}"
_src="${_src}_${PROJECT_VERSION}_${_target_os}-${_target_arch}"
_target_path="${_dest}/${_src}"
_src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-choco-${_src}"
_src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-${_src}"
I18N_Remake "$_src"
FS_Remake_Directory "$_src"
if [ $? -ne 0 ]; then
Expand All @@ -91,6 +92,7 @@ PACKAGE_Run_CHOCOLATEY() {
return 0
;;
0)
# accepted
;;
*)
I18N_Assemble_Failed
Expand All @@ -103,26 +105,34 @@ PACKAGE_Run_CHOCOLATEY() {
I18N_Check ".nuspec"
__name=""
for __file in "${_src}/"*.nuspec; do
FS_Is_File "${__file}"
if [ $? -eq 0 ]; then
if [ $(STRINGS_Is_Empty "$__name") -ne 0 ]; then
I18N_Check_Failed
return 1
fi

__name="${__file##*/}"
__name="${__name%.nuspec*}"
FS_Is_File "$__file"
if [ $? -ne 0 ]; then
continue
fi

if [ "$__file" = "${_src}/.nuspec" ]; then
continue
fi

__name="$(FS_Get_File "$__file")"
__name="${__name%.nuspec*}"
break
done

if [ $(STRINGS_Is_Empty "$__name") -eq 0 ]; then
I18N_Check_Failed
return 1
fi

FS_Copy_File "${_src}/${__name}.nuspec" "${_src}/.nuspec"
if [ $? -ne 0 ]; then
I18N_Check_Failed
return 1
fi


# archive the assembled payload
__name="${__name}-chocolatey_${PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg"
__name="${__name}_${PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg"
__name="${_dest}/${__name}"
I18N_Archive "$__name"
CHOCOLATEY_Archive "$__name" "$_src"
Expand Down
24 changes: 16 additions & 8 deletions automataCI/_package-chocolatey_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ function PACKAGE-Run-CHOCOLATEY {

# prepare workspace and required values
$null = I18N-Create-Package "CHOCOLATEY"
$_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}"
$_src = "${env:PROJECT_CHOCOLATEY_ID}-${_target_filename}"
$_src = "${_src}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}"
$_target_path = "${_dest}\${_src}"
$_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-choco-${_src}"
$_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-${_src}"
$null = I18N-Remake "${_src}"
$___process = FS-Remake-Directory "${_src}"
if ($___process -ne 0) {
Expand Down Expand Up @@ -94,25 +95,32 @@ function PACKAGE-Run-CHOCOLATEY {


# check nuspec is available
$null = I18N-Check ".nuspec metadata"
$null = I18N-Check ".nuspec"
$__name = ""
foreach ($__file in (Get-ChildItem -File -Path "${_src}\*.nuspec")) {
if ($(STRINGS-Is-Empty "${__name}") -ne 0) {
$null = I18N-Check-Failed
return 1
foreach ($__file in (Get-ChildItem -File -Path "${_src}" `
| Where-Object { ($_.Name -like "*.nuspec") })) {
if ($__file.Name -eq ".nuspec") {
continue
}

$__name = $__file.Name -replace '\.nuspec.*$', ''
break
}

if ($(STRINGS-Is-Empty "${__name}") -eq 0) {
$null = I18N-Check-Failed
return 1
}

$___process = FS-Copy-File "${_src}\${__name}.nuspec" "${_src}\.nuspec"
if ($___process -ne 0) {
$null = I18N-Check-Failed
return 1
}


# archive the assembled payload
$__name = "${__name}-chocolatey_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg"
$__name = "${__name}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg"
$__name = "${_dest}\${__name}"
$null = I18N-Archive "${__name}"
$___process = CHOCOLATEY-Archive "${__name}" "${_src}"
Expand Down
4 changes: 3 additions & 1 deletion automataCI/_release-citation_unix-any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ RELEASE_Run_CITATION_CFF() {
# execute
I18N_Publish "CITATION.cff"
if [ $(OS_Is_Run_Simulated) -ne 0 ]; then
FS_Copy_File "$1" "${PROJECT_PATH_ROOT}/CITATION.cff"
__dest="${PROJECT_PATH_ROOT}/CITATION.cff"
FS_Remove_Silently "$__dest"
FS_Copy_File "$1" "$__dest"
if [ $? -ne 0 ]; then
I18N_Publish_Failed
return 1
Expand Down
4 changes: 3 additions & 1 deletion automataCI/_release-citation_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ function RELEASE-Run-CITATION-CFF {
# execute
$null = I18N-Publish "CITATION.cff"
if ($(OS-Is-Run-Simulated) -ne 0) {
$___process = FS-Copy-File "${__target}" "${env:PROJECT_PATH_ROOT}\CITATION.cff"
$__dest = "${env:PROJECT_PATH_ROOT}\CITATION.cff"
$null = FS-Remove-Silently "${__dest}"
$___process = FS-Copy-File "${__target}" "${__dest}"
if ($___process -ne 0) {
$null = I18N-Publish-Failed
return 1
Expand Down
16 changes: 11 additions & 5 deletions automataCI/_release-lib_unix-any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ RELEASE_Run_LIBS() {
return 0
fi

if [ $(FS_Is_Target_A_TARGZ "$1") -ne 0 ] ||
[ $(FS_Is_Target_A_TARXZ "$1") -ne 0 ] ||
[ $(FS_Is_Target_A_ZIP "$1") -ne 0 ]; then
return 0
fi

GIT_Is_Available
if [ $? -ne 0 ]; then
return 0
Expand All @@ -56,17 +62,17 @@ RELEASE_Run_LIBS() {
# execute
__branch="v${PROJECT_VERSION}"
if [ $(FS_Is_Target_A_NPM "$1") -eq 0 ]; then
if [ $(STRINGS_Is_Empty "$PROJECT_NODE_BRANCH_TAG") -eq 0 ]; then
if [ $(STRINGS_Is_Empty "$PROJECT_NODE_NPM_ID") -eq 0 ]; then
return 0
fi

__branch="${__branch}_${PROJECT_NODE_BRANCH_TAG}"
__branch="${__branch}_${PROJECT_NODE_NPM_ID}"
elif [ $(FS_Is_Target_A_C "$1") -eq 0 ]; then
if [ $(STRINGS_Is_Empty "$PROJECT_C_BRANCH_TAG") -eq 0 ]; then
if [ $(STRINGS_Is_Empty "$PROJECT_C_ID") -eq 0 ]; then
return 0
fi

__branch="${__branch}_${PROJECT_C_BRANCH_TAG}"
__branch="${__branch}_${PROJECT_C_ID}"
else
return 0
fi
Expand Down Expand Up @@ -97,7 +103,7 @@ RELEASE_Run_LIBS() {
elif [ $(FS_Is_Target_A_ZIP "$1") -eq 0 ]; then
ZIP_Extract "$__workspace" "$1"
else
FS_Copy_File "$1" "${__workspace}"
FS_Copy_File "$1" "${__workspace}/$(FS_Get_File "$1")"
fi

if [ $? -ne 0 ]; then
Expand Down
18 changes: 13 additions & 5 deletions automataCI/_release-lib_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ function RELEASE-Run-LIBS {
return 0
}

if (($(FS-Is-Target-A-TARGZ "${__target}") -ne 0) -or
($(FS-Is-Target-A-TARXZ "${__target}") -ne 0) -or
($(FS-Is-Target-A-ZIP "${__target}") -ne 0)) {
return 0
}

$___process = GIT-Is-Available
if ($___process -ne 0) {
return 0
Expand All @@ -58,17 +64,17 @@ function RELEASE-Run-LIBS {
# execute
$__branch = "v${env:PROJECT_VERSION}"
if ($(FS-Is-Target-A-NPM "${__target}") -eq 0) {
if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_BRANCH_TAG}") -eq 0) {
if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_NPM_ID}") -eq 0) {
return 0
}

$__branch = "${__branch}_${env:PROJECT_NODE_BRANCH_TAG}"
$__branch = "${__branch}_${env:PROJECT_NODE_NPM_ID}"
} elseif ($(FS-Is-Target-A-C "${__target}") -eq 0) {
if ($(STRINGS-Is-Empty "${env:PROJECT_C_BRANCH_TAG}") -eq 0) {
if ($(STRINGS-Is-Empty "${env:PROJECT_C_ID}") -eq 0) {
return 0
}

$__branch = "${__branch}_${env:PROJECT_C_BRANCH_TAG}"
$__branch = "${__branch}_${env:PROJECT_C_ID}"
} else {
return 0
}
Expand Down Expand Up @@ -102,7 +108,9 @@ function RELEASE-Run-LIBS {
} elseif ($(FS-Is-Target-A-ZIP "${__target}") -eq 0) {
$___process = ZIP-Extract "${__workspace}" "${__target}"
} else {
$___process = FS-Copy-File "${__target}" "${__workspace}"
$___process = FS-Copy-File `
"${__target}" `
"${__workspace}\$(FS-Get-File "${__target}")"
}

if ($___process -ne 0) {
Expand Down
Loading

0 comments on commit f159527

Please sign in to comment.