{"id":16927781,"url":"https://github.com/dirien/rust-jreleaser","last_synced_at":"2026-02-09T13:06:02.899Z","repository":{"id":61045269,"uuid":"547448893","full_name":"dirien/rust-jreleaser","owner":"dirien","description":"Playing around with Rust and JReleaser","archived":false,"fork":false,"pushed_at":"2022-10-08T14:46:20.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-13T08:46:42.743Z","etag":null,"topics":["jreleaser","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dirien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2022-10-07T17:49:59.000Z","updated_at":"2023-12-14T23:39:30.000Z","dependencies_parsed_at":"2022-10-09T03:21:13.751Z","dependency_job_id":null,"html_url":"https://github.com/dirien/rust-jreleaser","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dirien/rust-jreleaser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirien%2Frust-jreleaser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirien%2Frust-jreleaser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirien%2Frust-jreleaser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirien%2Frust-jreleaser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dirien","download_url":"https://codeload.github.com/dirien/rust-jreleaser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirien%2Frust-jreleaser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29266214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T12:53:16.161Z","status":"ssl_error","status_checked_at":"2026-02-09T12:52:30.244Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jreleaser","rust"],"created_at":"2024-10-13T20:35:07.263Z","updated_at":"2026-02-09T13:06:02.883Z","avatar_url":"https://github.com/dirien.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to release Rust 🦀 apps with jReleaser\n\n## TL;DR Code\n\n%[https://github.com/dirien/rust-jreleaser]\n\n## Introduction\n\nRecently I decided to start learning Rust 🦀!\n\n![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665239841251/nHf9buDL5.png align=\"left\")\n\n%[https://twitter.com/_ediri/status/1577868970593583104?s=20\u0026t=0NWRHqD7ohV8drrQyYVkuQ]\n\nAnd of course, one of the important parts for me was: How can I release the binaries and distribute them. When I program in Golang, I always use [GoReleaser](https://goreleaser.com/) or [ko](https://github.com/ko-build/ko)\n\nUsed to these tools, I wanted a similar tool for Rust too. After searching though the Web and GitHub I found out that [jReleaser](https://jreleaser.org) is also able to release and deploy  Rust projects!\n\nIn this article, I want to show how to use jReleaser with a simple Rust CLI app and use Homebrew as a first distribution integration.\n\n## Prerequisites\n\nTo code along, you should install the following tools in your workstation:\n\n- [jReleaser](https://jreleaser.org)\n- [Rust](https://www.rust-lang.org)\n\n## Creation of the example app\n\nIn this example, we will create a simple Rust project and release it with `jReleaser`. The project will be a simple CLI application that prints the world-famous \"Hello, World!\" message.\n\nWith following command, you can scaffold an empty Rust project:\n\n```bash\ncargo init\n```\n\nThe output should look something like this:\n\n```bash\n     Created binary (application) package\n```\n\nNext, we want to pass the name of the person we want to greet as an argument to the application. For this, I am going to use `clap`, a [very popular library](https://docs.rs/clap/latest/clap/) for parsing command-line arguments.\n\nEnter this cargo command in your terminal:\n\n```bash\ncargo add clap --features derive\n```\n\nAnd the `clap` library will be added under `dependencies` to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nclap = { version = \"4.0.10\", features = [\"derive\"] }\n```\n\nWith features, we can add additional functionality to our dependencies. In this case, we want to use the `derive`\n\nThe final code of our application will look like this:\n\n```rust\nuse clap::{Parser, Subcommand};\n\n#[derive(Parser, Debug)]\n#[clap(author = \"Engin Diri\", version, long_about = None)]\n/// A very, very simple Hello World application\nstruct Args {\n    #[clap(subcommand)]\n    cmd: Commands,\n}\n\n#[derive(Subcommand, Debug)]\nenum Commands {\n    /// Greet someone\n    Greet {\n        /// Name of the person to greet\n        #[clap(default_value = \"Unknown\")]\n        name: String,\n    },\n}\n\nfn main() {\n    let args = Args::parse();\n    match args.cmd {\n        Commands::Greet { name } =\u003e println!(\"Hello, {}!\", name),\n    }\n}\n```\n\nThe notable parts are the definition of the `Args` struct and the `SubCommand` enum. In the `Args` struct, we refer to the `SubCommand` enum as a subcommand. This means that we can call our application with `greet` as a subcommand.\n\nThe `Greet` struct is a struct that contains the `name` argument. The `name` argument is a string that defaults to `Unknown` if no value is provided.\n\nIn the `main` function, we parse the arguments and match the subcommand. If the subcommand is `greet`, we print the message.\n\nGo try it out:\n\n```bash\ncargo run -- greet Engin\n```\n\nShould print:\n\n```bash\nHello, Engin!\n```\n\nIf you don't provide a name, it will default to `Unknown`:\n\n```bash\ncargo run -- greet\n```\n\nShould print:\n\n```bash\nHello, Unknown!\n```\n\n## Release with jReleaser\n\n### Initialize jReleaser\n\nTo install jReleaser for your platform, please refer to the [installation guide](https://jreleaser.org/guide/latest/install.html#_stable).\n\nI am a macOS user, that is the reason I will use Homebrew to install jReleaser:\n\n```bash\nbrew install jreleaser/tap/jreleaser\n```\n\nAfter the installation, we can initialize jReleaser:\n\n```bash\njreleaser init --format yml \n```\n\nThis will create a `jreleaser.yml` file in the current directory.\n\nSome values in the file are already filled in, and you need to change them to match your project. As we are going to use Homebrew, we need to add the `packagers` section with the right values. Here I added the `tap` name and `commitAuthor`\n\n```yaml\npackagers:\n  brew:\n    active: ALWAYS\n    commitAuthor:\n      name: dirien\n      email: engin.diri@mail.schwarz\n    tap:\n      owner: dirien\n      name: homebrew-dirien-dev\n```      \n\nThe rest of the file `jreleaser.yml` is pretty straightforward. You can find more information about the configuration [here](https://jreleaser.org/guide/latest/configuration/index.html)\n\nNow you can build your project with cargo:\n\n  ```bash\n  cargo build --release --all-features\n```\n\nAssemble the artifacts:\n\n```bash\njreleaser assemble -grs\n```\n\nAnd check the configuration with:\n\n```bash\njreleaser config\n```\n\nYou should see something like this:\n\n```bash\n[INFO]  JReleaser 1.2.0\n[INFO]  Konfiguriere mit jreleaser.yml\n[INFO]    - Basisverzeichnis 'basedir' ist /Users/dirien/Tools/repos/rust-jreleaser\n[INFO]  Reading configuration\n[INFO]  Loading variables from /Users/dirien/.jreleaser/config.properties\n[WARN]  Variables source /Users/dirien/.jreleaser/config.properties does not exist\n[INFO]  Validating configuration\n...\n```\n\nLooks very good, now we are ready to create a GitHub workflow to release our project.\n\n### Create the GitHub actions\n\nAs we're going to create binaries for multiple platforms, we need to create a GitHub workflow which will build the binaries on multiple platforms. For this case, I will use the `matrix` feature of GitHub actions.\n\n```yaml\n...\nstrategy:\n  fail-fast: true\n  matrix:\n    os: [ ubuntu-latest, macOS-latest, windows-latest ]\nruns-on: ${{ matrix.os }}\n...\n```\n\nSo we have two jobs, one called `build` and the other called `release`.\n\nThe notable parts of the `build` job are, that we set the toolchain to `stable` and we use the `actions-rs/cargo` action to build the project. Next step is to call the jReleaser assemble command to assemble the artifacts and finally we upload the artifacts to a folder called `artifacts`.\n\n```yaml\n      - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # tag=v1.0.7\n        with:\n          toolchain: stable\n\n      - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # tag=v1.0.3\n        with:\n          command: build\n          args: --release --all-features\n\n      - name: jReleaser assemble\n        uses: jreleaser/release-action@9d00b8a3e38acac18558faf7152ca24368ed0d9f # tag=v2.2.0\n        with:\n          arguments: assemble\n        env:\n          JRELEASER_GITHUB_TOKEN: ${{ secrets.GH_PAT }}\n\n      - name: Upload artifacts\n        uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0\n        with:\n          name: artifacts\n          path: |\n            out/jreleaser/assemble/rust-jreleaser/archive/*.zip\n```\n\nThe `release` job very simple, it will download the artifacts folder and uses the `jreleaser/release-action` action to execute the `release` command from jReleaser. Use `PartifactsDir` flag to point to the `artifacts` folder.\n\n```yaml\n      - name: Download artifacts\n        uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # tag=v3.0.0\n\n      - name: jReleaser release\n        uses: jreleaser/release-action@9d00b8a3e38acac18558faf7152ca24368ed0d9f # tag=v2.2.0\n        with:\n          arguments: release -PartifactsDir=artifacts -PskipArchiveResolver\n        env:\n          JRELEASER_GITHUB_TOKEN: ${{ secrets.GH_PAT }}\n```\n\n\u003e As we going to write to a different repository, we need to create a personal access token with the `repo` scope and add it to the GitHub secrets. The name is `GH_PAT`.\n\n## Release\n\nNow we are ready to release our project. We need to create a tag and push it to GitHub. I will use the `v0.1.2` tag for and push it to GitHub.\n\n![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665239621090/FSswfRl9M.png align=\"left\")\n\nIf everything went well, you should see the artifacts under the release page, and you should be able to install the binary via Homebrew.\n\n```bash\nbrew install dirien/homebrew-dirien-dev/rust-jreleaser\nRunning `brew update --auto-update`...\n==\u003e Auto-updated Homebrew!\nUpdated 2 taps (dirien/dirien-dev and homebrew/core).\n\nYou have 28 outdated formulae installed.\nYou can upgrade them with brew upgrade\nor list them with brew outdated.\n\n==\u003e Downloading https://github.com/dirien/rust-jreleaser/releases/download/v0.1.2/rust-jreleaser-0.1.2-darwin-amd64.zip\n==\u003e Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/547448893/7b2bf4ad-0cdd-49e5-ba23-49cb580d1963?X-Amz-Algorithm=AWS4-\n######################################################################## 100.0%\n==\u003e Installing rust-jreleaser from dirien/dirien-dev\n🍺  /usr/local/Cellar/rust-jreleaser/0.1.2: 5 files, 1003.6KB, built in 5 seconds\n==\u003e Running `brew cleanup rust-jreleaser`...\nDisable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.\nHide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).\nRemoving: /Users/dirien/Library/Caches/Homebrew/rust-jreleaser--0.1.0.zip... (394.7KB)\n```\n\nAnd the final test, with running the app:\n\n```bash\nrust-jreleaser\nA very, very simple Hello World application\n\nUsage: rust-jreleaser \u003cCOMMAND\u003e\n\nCommands:\n  greet  Greet someone\n  help   Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help information\n  -V, --version  Print version information\n```\n\n## Wrap-Up\n\n`JReleaser` is a very powerful tool, not only for JVM based application but also for Rust.\n\nNext steps would be from here:\n\n- Add signing with Cosign\n- Create a Docker Image\n- Add ARM architecture\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirien%2Frust-jreleaser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirien%2Frust-jreleaser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirien%2Frust-jreleaser/lists"}