Skip to content

Feature/4 release artifacts#5

Open
zsrdjan wants to merge 7 commits intomainfrom
feature/4-release-artifacts
Open

Feature/4 release artifacts#5
zsrdjan wants to merge 7 commits intomainfrom
feature/4-release-artifacts

Conversation

@zsrdjan
Copy link

@zsrdjan zsrdjan commented Jan 19, 2026

Fix build pipeline: release artifacts and Docker publish only on v* tags

This PR updates the CI/CD pipeline to properly handle release builds triggered by version tags with the following improvements:

Changes

1. Release Detection

  • Release builds now trigger only for Git tags with prefix v* (e.g., v2026.1.0, v1.0.0-preview.0)
  • Added detection for stable vs. prerelease versions (versions without - are stable)
  • Version is extracted from Git tag and passed to all build steps

2. Build Configuration

  • Version from Git tag is passed to dotnet build via /p:Version parameter
  • Added /p:TreatWarningsAsErrors=true to enforce code quality
  • Updated Directory.Build.props to use 0.0.0 as placeholder (overridden by Git tag in pipeline)
  • Removed explicit AssemblyVersion and FileVersion (MSBuild auto-derives from Version)

3. Build Artifacts

  • Artifact names now include version (e.g., RestServer-2026.1.0-preview.0)
  • Retention: 90 days for stable releases, 7 days for other builds

4. GitHub Releases (Stable Releases Only)

  • Creates ZIP archives for framework-dependent and self-contained builds
  • Automatically creates GitHub Release with ZIP attachments
  • Auto-generates release notes
  • Only runs for stable releases (no prerelease suffix)

5. Docker Images

  • Tags images with version from Git tag using semantic versioning
  • latest tag only applied to stable releases (not preview/beta/rc versions)
  • Pushes to Docker Hub only for v* tags

6. Permissions

  • Added contents: write permission for creating GitHub releases
  • Added packages: write permission for uploading artifacts

@zsrdjan zsrdjan self-assigned this Jan 19, 2026
@zsrdjan zsrdjan requested a review from novakklemen January 19, 2026 16:20
/// <param name="mustangCliService">The Mustang CLI service for executing commands.</param>
/// <param name="uploadedFile">The file upload request with the PDF file to validate.</param>
/// <param name="loggerFactory">The logger factory for creating loggers.</param>
/// <param name="cancellationToken">The cancellation token for managing task cancellation.</param>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param name was missing which caused a build warning.

# Build and test
- name: Build solution
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore /p:Version=${{ steps.is_release.outputs.version }} /p:TreatWarningsAsErrors=true
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TreatWarningsAsErrors added so that we fail the build in case of warnings

files: |
publish/Docentric.EInvoice.Validator.RestServer-${{ steps.is_release.outputs.version }}.zip
publish/Docentric.EInvoice.Validator.RestServer-Self-Contained-${{ steps.is_release.outputs.version }}.zip
generate_release_notes: true
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how the automatically created release would look like:
https://github.com/Docentric/docentric-e-invoice-validator/releases/tag/v2016.1.0

# Tag with version from Git tag (e.g., "v1.2.3" -> "1.2.3", "v1.2.3-preview.0" -> "1.2.3-preview.0")
type=semver,pattern={{version}}
# Tag "latest" only for stable releases (no prerelease suffix)
type=raw,value=latest,enable=${{ needs.build.outputs.is_stable == 'true' }}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest tag will be set only for the "stable" releases. We don't want a preview version to be marked as latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant