---
tags: Automatic Release Field, Workflow
---
# Workflow: Building a Package with Automatic Release and Changelog Fields
* Packager submits build using fedpkg (spec file uses `%autorel` and/or `%autochangelog`)
* Koji `buildSRPMFromSCM` step:
* rpmautospec_plugin (~~TBD: rename from `rpmautospec_plugin` as we have two plugins now~~ **DONE** in [PR#28](https://pagure.io/Fedora-Infra/rpmautospec/pull-request/28)):
* Detects presence of `%autorel`/`%autochangelog` in the spec file
* Release bumping code:
* Retrieves latest EVRs of the package for all Fedora versions (i.e. values of the %dist tag) from the Koji list of builds
* If needed, tags these latest builds in dist-git Pagure (~~TBD (Issues ([#42](https://pagure.io/Fedora-Infra/rpmautospec/issue/42)) [#43](https://pagure.io/Fedora-Infra/rpmautospec/issue/43) [#44](https://pagure.io/Fedora-Infra/rpmautospec/issue/44)~~ **DONE** in PRs [#80](https://pagure.io/Fedora-Infra/rpmautospec/pull-request/80), [#97](https://pagure.io/Fedora-Infra/rpmautospec/pull-request/97))
* Determines next release according to normal release cadence
* Determines next release for hotfix (tighter upgrade path constraints) and prerelease ("0." prefix) use cases **TBD** (WIP: [PR#15](https://pagure.io/Fedora-Infra/rpmautospec/pull-request/15))
* Changelog generation:
* Processes commits since the last time the `changelog` was changed, and appends it (if it exists).
* Uses tags of the form `build/%{name}-%{epoch}-%{version}-%{release}` to decorate entries with simplified `%{version}-%{release}`, i.e. stripping out `%{dist}`.
* Merges entries of the same committer from the same date if they end up in the same build.
* Inserts the header defining the `%autorel` macro with the previously computed values at the top of the spec file. (~~TBD: Use the fully-fledged macro understanding arguments from the docs~~ **DONE** in [PR#41](https://pagure.io/Fedora-Infra/rpmautospec/pull-request/41))
* Replaces anything after `%changelog` with the generated changelog.
* builds srpm from modified spec file, freezing release and changelog
* Koji `buildArch` step(s)
* Koji `tagBuild` step
* Tags the commit of the successful build with `build/%{name}-%{epoch}-%{version}-%{release}` in dist-git Pagure
* Tags the build with the appropriate Koji tag(s)