How to publish my .msi file after running my CI/CD pipeline?

I created a Pipeline on gitlab.com for my .NET project with Shared runners and a build step in which I create a .msi installer for the (Windows) users.

The artifact I created in the build step comes in an archive. Zipping a .msi file seems useless to me, since it is already an archive.

But in the release step I managed to expose the .msi to the public by creating a link to
https://gitlab.com/<account>/<project>/-/jobs/${GE_JOB_ID}/artifacts/raw/path/to/the.msi
on the release page.

I made my project public, so my users can see my release page with the .msi-link and download the software.
It all works… but only when I am logged in. When I log out and click on the link, I get a 404 error. And I don’t want every user to create a gitlab account just to download the software!

I read this article:
download-a-single-artifact-file-by-job-id
but I don’t know how this approach can be useful to me. The link in this format does not seem to work for me. Am I wrong?

Actually what I want, is when I create a new tag (with only: - tags?) that my audience can download a new version of my application within minutes. Is the approach I did the best approach? If so, how can the link be publicly available?

For others with the same problem, I found the answer myself.
After a few weeks I discovered that creating a Release is not the way to go. I read something about Generic Packages and got the feeling that this could be the solution. An .msi file is nothing but a package after all.

So I skipped a Release stage in my .gitlab-ci.yml file and added the following line to my build stage:

  script:
- Invoke-RestMethod -Headers @{ "JOB-TOKEN"="$CI_JOB_TOKEN" } -InFile 'relative-path-to-your.msi' -uri "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/projectname_${CI_COMMIT_TAG}/${CI_COMMIT_REF_NAME}/projectname_${CI_COMMIT_TAG}.msi" -Method put

How do you create an MSI in pipeline, is there documentation or tutorial somewhere? TIA

You will have to create a WiX project in your solution. Search for WiX.

Succes!

I have done that, but the pipeline uses Linux docker container, so that doesn’t support Wix. Is there a way to use windows docker container?

Have a look at my pipeline:
https://gitlab.com/alfonsvanzwol/widm-exam

1 Like