# Packaging newdoc
The following are instructions for the maintainers of `newdoc` to package and distribute new releases.
## Preparing a new version
1. Update newdoc dependencies:
```
$ cargo update
```
2. Make your changes to the code and merge them to the `main` branch.
3. Update the version number in `Cargo.toml` and `newdoc.spec`. The versions must be identical.
4. Commit the version update:
```
$ git commit -am "Update the version to X.Y.Z"
```
5. Tag the latest commit with the new version number:
```
$ git tag -a vX.Y.Z -m "Version X.Y.Z"
```
Make sure to prefix the version in the tag name with "v" for "version".
6. Push the version tag to the remote repository:
```
$ git push --follow-tags
```
If you're using several remote repositories, such as origin and upstream, make sure to push the tag to all of them.
## Packaging and distributing newdoc as an RPM package
1. Log into the Copr repository administration.
Currently, newdoc is packaged in the [mmuehlfeldrh/newdoc-rs](https://copr.fedorainfracloud.org/coprs/mmuehlfeldrh/newdoc-rs/) repository.
2. Go to the **Builds** tab.
3. Click **New Build**.
4. Select **SCM**.
5. In the **Clone url** field, paste `https://github.com/redhat-documentation/newdoc`.
6. In the **Spec File** field, use `newdoc.spec`.
7. Click **Build**.
## Packaging and distributing newdoc with Homebrew
1. Make sure you have access to the existing Homebrew repository.
Currently, newdoc is packaged in [redhat-documentation/homebrew-repo](https://github.com/redhat-documentation/homebrew-repo).
2. Download the `.tar.gz` archive that Github created for your latest tagged version:
<https://github.com/redhat-documentation/newdoc/tags>
3. Calculate the SHA256 checksum of this archive:
```
$ sha256sum vX.Y.Z.tar.gz
```
4. In the `homebrew-repo` repository, edit the `Formula/newdoc.rb` file.
5. In the `url` attribute, update the version in the URL to your latest version.
6. In the `sha256` attribute, replace the existing checksum with the new checksum that you calculated.
7. Commit and push the changes.
## Packaging and distributing newdoc on Quay.io
Currently, newdoc is packaged in [redhat-documentation/newdoc](https://quay.io/repository/redhat-documentation/newdoc).
When you push a tagged version to the [redhat-documentation/newdoc](https://github.com/redhat-documentation/newdoc) Git repository, it automatically triggers a rebuild of the container.
The version tag must start with "v" and match the `v.*` regular expression.
Details on configuring the automatic build trigger: TODO.
## Packaging and distributing newdoc on Crates.io
1. If you are publishing to Crates.io for the first time on this system, log into your account:
```
$ cargo login
```
You can manage your login tokens in your account settings: <https://crates.io/me>.
2. Publish the latest version of `newdoc` to Crates.io:
```
$ cargo publish
```