Fix Go and Python package publishing workflows
This commit is contained in:
1 parent
72a5e289f6
commit
752f3ba433
2 files changed
+56
-6
No files matched your search
@@ -38,9 +38,10 @@ jobs:
|
||||
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref_name }}
|
||||
run: |
|
||||
package_directory='gitea-go-package'
|
||||
rm -rf "$package_directory"
|
||||
mkdir -p "$package_directory"
|
||||
bash scripts/package-go-module.sh "$RELEASE_TAG" "$package_directory"
|
||||
mkdir -p "$RUNNER_TEMP/gitea-go-package"
|
||||
cp "$package_directory"/*.zip "$RUNNER_TEMP/gitea-go-package/"
|
||||
find "$package_directory" -maxdepth 1 -type f -name '*.zip' -print -quit | grep -q .
|
||||
|
||||
- name: Publish to Gitea Package Registry
|
||||
env:
|
||||
@@ -53,8 +54,25 @@ jobs:
|
||||
echo 'PACKAGE_REGISTRY_USERNAME and PACKAGE_REGISTRY_TOKEN secrets are required.' >&2
|
||||
exit 1
|
||||
fi
|
||||
package_file="$(find "$RUNNER_TEMP/gitea-go-package" -maxdepth 1 -type f -name '*.zip' -print -quit)"
|
||||
package_file="$(find gitea-go-package -maxdepth 1 -type f -name '*.zip' -print -quit)"
|
||||
test -n "$package_file"
|
||||
curl --fail-with-body --user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
|
||||
response_file="$(mktemp)"
|
||||
http_status="$(curl --silent --show-error --fail-with-body \
|
||||
--user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
|
||||
--output "$response_file" \
|
||||
--write-out '%{http_code}' \
|
||||
--upload-file "$package_file" \
|
||||
"$GITEA_GO_REGISTRY"
|
||||
"$GITEA_GO_REGISTRY" || true)"
|
||||
case "$http_status" in
|
||||
201)
|
||||
echo 'Go package published.'
|
||||
;;
|
||||
409)
|
||||
echo 'Go package version already exists; leaving the immutable package unchanged.'
|
||||
;;
|
||||
*)
|
||||
cat "$response_file" >&2
|
||||
echo "Gitea Go package upload failed with HTTP status $http_status." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user