generated from Templates/Baseline
add tests
This commit is contained in:
parent
0426f300c6
commit
803a79e380
@ -17,7 +17,6 @@ steps:
|
|||||||
from_secret: gitea_user
|
from_secret: gitea_user
|
||||||
password:
|
password:
|
||||||
from_secret: gitea_passwd
|
from_secret: gitea_passwd
|
||||||
debug: "true"
|
|
||||||
owner: "plugins"
|
owner: "plugins"
|
||||||
package_name: "dummy_package"
|
package_name: "dummy_package"
|
||||||
package_version: "0.1.0"
|
package_version: "0.1.0"
|
||||||
@ -27,7 +26,8 @@ steps:
|
|||||||
when:
|
when:
|
||||||
event: pull_request
|
event: pull_request
|
||||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
next-nodebug:
|
|
||||||
|
next-debug:
|
||||||
image: gitea.ocram85.com/plugins/gitea-package:next
|
image: gitea.ocram85.com/plugins/gitea-package:next
|
||||||
pull: true
|
pull: true
|
||||||
secrets: [ gitea_user, gitea_passwd]
|
secrets: [ gitea_user, gitea_passwd]
|
||||||
@ -42,6 +42,27 @@ steps:
|
|||||||
file_source: "./README.md"
|
file_source: "./README.md"
|
||||||
file_name: "readme.md"
|
file_name: "readme.md"
|
||||||
update: "true"
|
update: "true"
|
||||||
|
debug: "true"
|
||||||
|
when:
|
||||||
|
event: pull_request
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
|
next-no-update:
|
||||||
|
image: gitea.ocram85.com/plugins/gitea-package:next
|
||||||
|
pull: true
|
||||||
|
failure: ignore
|
||||||
|
secrets: [ gitea_user, gitea_passwd]
|
||||||
|
settings:
|
||||||
|
user:
|
||||||
|
from_secret: gitea_user
|
||||||
|
password:
|
||||||
|
from_secret: gitea_passwd
|
||||||
|
owner: "plugins"
|
||||||
|
package_name: "dummy_package"
|
||||||
|
package_version: "0.1.0"
|
||||||
|
file_source: "./README.md"
|
||||||
|
file_name: "readme.md"
|
||||||
|
debug: "true"
|
||||||
when:
|
when:
|
||||||
event: pull_request
|
event: pull_request
|
||||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
@ -26,13 +26,16 @@ sayW() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
showHelp() {
|
# TODO: Disabled for now. No default help output needed if just running as
|
||||||
cat << HELP
|
# Woodpecker CI plugin.
|
||||||
🤖 gitea-package Woodpecker-CI Plugin
|
#
|
||||||
|
#showHelp() {
|
||||||
Syntax:
|
# cat << HELP
|
||||||
HELP
|
# 🤖 gitea-package Woodpecker-CI Plugin
|
||||||
}
|
#
|
||||||
|
# Syntax:
|
||||||
|
#HELP
|
||||||
|
#}
|
||||||
|
|
||||||
showENV() {
|
showENV() {
|
||||||
env | sort
|
env | sort
|
||||||
@ -75,23 +78,23 @@ deleteArtifact() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uploadArtifact() {
|
uploadArtifact() {
|
||||||
say "Testing if the artifact already exists in give package version..." "uploadArtifact"
|
say "Testing if the given artifact already exists in the package registry..." "uploadArtifact"
|
||||||
fexist=$(testArtifact)
|
fexist=$(testArtifact)
|
||||||
if [ "$fexist" = "true" ]; then
|
if [ "$fexist" = "true" ]; then
|
||||||
if [ -n "$PLUGIN_UPDATE" ]; then
|
if [ -n "$PLUGIN_UPDATE" ]; then
|
||||||
sayW "Given file already exists. Updating package file..." "uploadArtifact"
|
sayW "🚧 Given file already exists. Removing remote file..." "uploadArtifact"
|
||||||
deleteArtifact
|
deleteArtifact
|
||||||
else
|
else
|
||||||
sayW "A file with the same name exist already in the package." "uploadArtifact"
|
sayW "🛑 File already exists in the package registry." "uploadArtifact"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
say "Starting file upload..." "uploadArtifact"
|
say "Starting file upload... ($PLUGIN_FILE_SOURCE)" "uploadArtifact"
|
||||||
cout=$(curl --silent --output /dev/null --write-out "%{http_code}" \
|
cout=$(curl --silent --output /dev/null --write-out "%{http_code}" \
|
||||||
--user "$PLUGIN_USER:$PLUGIN_PASSWORD" \
|
--user "$PLUGIN_USER:$PLUGIN_PASSWORD" \
|
||||||
--upload-file "$PLUGIN_FILE_SOURCE" \
|
--upload-file "$PLUGIN_FILE_SOURCE" \
|
||||||
"$CI_FORGE_URL/api/packages/$PLUGIN_OWNER/generic/$PLUGIN_PACKAGE_NAME/$PLUGIN_PACKAGE_VERSION/$PLUGIN_FILE_NAME")
|
"$CI_FORGE_URL/api/packages/$PLUGIN_OWNER/generic/$PLUGIN_PACKAGE_NAME/$PLUGIN_PACKAGE_VERSION/$PLUGIN_FILE_NAME")
|
||||||
say "Curl output is: $cout" "uploadArtifact"
|
say "Curl http response code: $cout" "uploadArtifact"
|
||||||
|
|
||||||
if [ "$cout" = "201" ]; then
|
if [ "$cout" = "201" ]; then
|
||||||
say "Upload sucessfully finished." "uploadArtifact"
|
say "Upload sucessfully finished." "uploadArtifact"
|
||||||
|
Loading…
Reference in New Issue
Block a user