diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index fdcc925..b03019b 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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 - npm publish + # 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