第一部分相对简单,使用一个步骤来检查复选框的值并根据它设置一个参数 - 这里我使用了 powershell 但这可以在 bash 中完成(我假设 powershell 因为你正在生产 nuget包)
请注意,我稍微颠倒了您的逻辑,但它会产生您想要的结果。
- 定义两个变量

- 设置复选框

- 设置两个构建步骤

- 第一步,测试参数并用它来设置另一个参数

- 在第二步中,我证明该值已正确设置

You should be able to use %ReleaseSuffix% when you need it.
Regarding your second requirement, I'm again going to make an assumption that you only want to publish a nuget package based on it being a Release build rather than a Pre-Release (if I've assumed this incorrectly let me know)
Conditional build steps based on a parameter value are something I've been tracking for a while now on YouTrack. This has been requested since 2011, but has still not made it in as a feature. I made this comment back in 2014 as a work around, but don't have the Java skills (you might) - My comment on YouTrack Issue
There is an alternative way to get this working, that might require some reworking of your build configurations.
If your "Publish NuGet" step is not triggered by anything (assumming it's triggered by the previous build finishing) then you could have a build step that
- Checks the %ReleaseSuffix% parameter
- Calls the REST API to trigger the build to publish the NuGet
It would potentially look something like this - just ensure you replace the highlighted bits

TeamCity Documentation
Hope this helps