Build the .NET package, and let a re-run pass the registries it already filled
build / build (push) Failing after 15m53s
build / build (push) Failing after 15m53s
With PACKAGES_TOKEN in place, npm and PyPI published 0.2.0 and NuGet failed:
error NU5026: The file '.../bin/Release/net6.0/Maxvojtkov.Dokploy.dll'
to be packed was not found on disk.
The generated csproj sets GeneratePackageOnBuild, and `dotnet pack` on such a
project skips compiling -- it assumes the build already packed -- so it packs
an assembly nothing ever built. Pack with the property turned off and it builds
the project itself.
That left the release half-published again, and re-running it would have
stopped at the first registry that already had 0.2.0: Gitea answers a repeat
publish with 409, which npm and the Go upload both treat as fatal. Every
publish step is now idempotent -- npm checks first, twine takes
--skip-existing, the Go upload accepts 409, and NuGet already had
--skip-duplicate -- so a release that fails halfway can simply be run again.
This commit is contained in:
@@ -154,7 +154,14 @@ jobs:
|
||||
@maxvojtkov:registry=https://${GITEA_HOST}/api/packages/${GITEA_OWNER}/npm/
|
||||
//${GITEA_HOST}/api/packages/${GITEA_OWNER}/npm/:_authToken=${TOKEN}
|
||||
EOF
|
||||
# A re-run of a half-finished release must get past the registries
|
||||
# that already have this version -- Gitea answers a repeat publish
|
||||
# with 409 and npm treats that as fatal.
|
||||
if npm view "@maxvojtkov/pulumi-dokploy@${VERSION}" version >/dev/null 2>&1; then
|
||||
echo "@maxvojtkov/pulumi-dokploy@${VERSION} is already published"
|
||||
else
|
||||
npm publish
|
||||
fi
|
||||
|
||||
- name: Publish to the Gitea PyPI registry
|
||||
working-directory: pulumi-dokploy/sdk/python
|
||||
@@ -164,7 +171,7 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade build twine
|
||||
python -m build
|
||||
python -m twine upload \
|
||||
python -m twine upload --skip-existing \
|
||||
--repository-url "https://${GITEA_HOST}/api/packages/${GITEA_OWNER}/pypi" \
|
||||
dist/*
|
||||
|
||||
@@ -173,7 +180,13 @@ jobs:
|
||||
env:
|
||||
TOKEN: ${{ secrets.PACKAGES_TOKEN }}
|
||||
run: |
|
||||
dotnet pack --configuration Release --output ./nupkg
|
||||
# The generated csproj sets GeneratePackageOnBuild, and `dotnet pack`
|
||||
# on such a project skips compiling -- it assumes the build already
|
||||
# packed -- then fails with NU5026 because the assembly it wants to
|
||||
# pack was never produced. Turn the property off for this invocation
|
||||
# and pack builds the project itself, as it normally would.
|
||||
dotnet pack --configuration Release --output ./nupkg \
|
||||
-p:GeneratePackageOnBuild=false
|
||||
dotnet nuget push ./nupkg/*.nupkg \
|
||||
--source "https://${GITEA_HOST}/api/packages/${GITEA_OWNER}/nuget/index.json" \
|
||||
--api-key "$TOKEN" --skip-duplicate
|
||||
@@ -198,8 +211,14 @@ jobs:
|
||||
cp sdk/go.mod sdk/go.sum "$DEST/"
|
||||
cp -R sdk/go "$DEST/"
|
||||
(cd "$STAGE" && zip -qrD "$STAGE/sdk.zip" . -x 'sdk.zip')
|
||||
curl -fsSL -X PUT \
|
||||
# 409 means this version is already in the registry, which is the
|
||||
# expected answer when a partly finished release is re-run.
|
||||
CODE="$(curl -sS -o /dev/null -w '%{http_code}' -X PUT \
|
||||
--user "${GITEA_OWNER}:${TOKEN}" \
|
||||
--upload-file "$STAGE/sdk.zip" \
|
||||
"https://${GITEA_HOST}/api/packages/${GITEA_OWNER}/go/upload"
|
||||
echo "Published $MODULE@v${VERSION}"
|
||||
"https://${GITEA_HOST}/api/packages/${GITEA_OWNER}/go/upload")"
|
||||
case "$CODE" in
|
||||
201) echo "Published $MODULE@v${VERSION}" ;;
|
||||
409) echo "$MODULE@v${VERSION} is already published" ;;
|
||||
*) echo "Go registry upload failed with HTTP $CODE"; exit 1 ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user