Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfae1cb572 | ||
|
|
752f3ba433 |
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
|
||||
@@ -37,6 +37,38 @@ jobs:
|
||||
python -m pip install --disable-pip-version-check --no-cache-dir build twine
|
||||
package_directory="$RUNNER_TEMP/gitea-pypi-package"
|
||||
python -m build packages/python-backend --outdir "$package_directory"
|
||||
package_index_url="${TWINE_REPOSITORY_URL%/}/simple/gabriel20xx-shared-backend/"
|
||||
package_index_file="$(mktemp)"
|
||||
package_index_status="$(curl --silent --show-error --fail-with-body \
|
||||
--user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
|
||||
--output "$package_index_file" \
|
||||
--write-out '%{http_code}' \
|
||||
"$package_index_url" || true)"
|
||||
package_files=("$package_directory"/*)
|
||||
files_to_upload=()
|
||||
case "$package_index_status" in
|
||||
200)
|
||||
for package_file in "${package_files[@]}"; do
|
||||
if ! grep -Fq "$(basename "$package_file")" "$package_index_file"; then
|
||||
files_to_upload+=("$package_file")
|
||||
fi
|
||||
done
|
||||
;;
|
||||
404)
|
||||
files_to_upload=("${package_files[@]}")
|
||||
;;
|
||||
*)
|
||||
cat "$package_index_file" >&2
|
||||
echo "Gitea PyPI package lookup failed with HTTP status $package_index_status." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ "${#files_to_upload[@]}" -eq 0 ]; then
|
||||
echo 'Python package version already exists with all build artifacts; leaving it unchanged.'
|
||||
exit 0
|
||||
fi
|
||||
TWINE_USERNAME="$PACKAGE_REGISTRY_USERNAME" \
|
||||
TWINE_PASSWORD="$PACKAGE_REGISTRY_TOKEN" \
|
||||
python -m twine upload --non-interactive --skip-existing "$package_directory"/*
|
||||
python -m twine upload --non-interactive \
|
||||
--repository-url "$TWINE_REPOSITORY_URL" \
|
||||
"${files_to_upload[@]}"
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "gabriel20xx-shared-backend"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "Shared PostgreSQL and authentication primitives for Python services."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
|
||||
Reference in new issue
Block a user