- Go 98.3%
- Makefile 1.7%
| cmd | ||
| pkg | ||
| .forgerel.yaml | ||
| .gitignore | ||
| forgerel.go | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| README.md | ||
Forgerel
Build your code and make release in code forge (currently supported: forgejo)
The idea
I want to simply have a command that I run that will:
- figure out git tag
- build my code
- calculate checksums
- sign the checksums with my gpg key
- publish all of this as release in forgejo
Usage
First, you need to provide credentials for your forgejo instance.
Generate access token with read/write access to repository. You don't need to give it any more permissions.
Save the token using:
forgerel login https://forgejo.url access_token
Token will be stored encrypted in your keystore. This library is used for storing tokens, if you care about that kind of stuff.
Now, you need to create .forgerel.yaml in your repository that you will want to publish.
It looks like this:
#this GPG key will be used to sign the checksums in release
gpg_key: 4F17573C2A87B286E1747E22C84D508B1FBEFFEA
commands:
- 'env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app_linux_amd64'
- 'env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o app_linux_arm64'
- 'env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o app_freebsd_amd64'
artifacts:
- app_linux_amd64
- app_linux_arm64
- app_freebsd_amd64
forge_url: https://forgejo.url
forge_repo_owner: repoownerusername
forge_repo_name: app
Or even take a look at .forgejo-rel.yaml in this repository.
After this is done, tag your repository according to semver rules, except with v prefix
git tag v1.0.0
And now, you are ready to make your first release:
forgerel release
This will:
- figure out tag number (from git)
- run build commands
- calculate sha512 checksums of your artifacts
- sign the calculated sha512 checksums with your gpg key
- create release in forgejo
- upload artifacts, checksum and signature to newly created release
Non-goals
This was created to solve my specific problem, and the following are what I don't want to do:
- support skipping gpg signature
- support other hashing algorithms (unless something much better than sha512 appears)
Support for code forges other than forgejo
I'm open to supporting other code forges. Gitea should work out of the box as (at least for now) they are mostly the same.
Installation
You can run make install to compile forgerel and install it to $HOME/.local/bin/forgerel
You can also download forgerel from releases page of this repository and copy it to PATH.