# Guidelines

- Scripts must use `set -euo pipefail`
- All work should be done in a temporary directory (`mktemp -d`)
- Currently, only amd64 will be supported
- Must exit without rebuilding/repackaging if the program is already up-to-date

## Building

- The directory for built programs is specified with the `COMPILED_DIR` environment variable, falling back to `/compiled`
  - Built programs should be `.tar.zst` files placed in `$COMPILED_DIR/[package name]/`
    - The archives should *not* contain a parent directory.
- Programs should be built on Debian, unless there's a specific reason not to.
- There should be a `build` branch for building the program.
- Versions
  - Old versions of the package should be removed
  - A file at `$COMPILED_DIR/[package name]/version` should contain the current version
  - There should be a symlink from `[package name].tar.zst` to the current version

## Packaging

- The package repo is specified with the `REPO_DIR` environment variable, falling back to `/repo`
- Packages should be built on the distro they're for, unless there's a specific reason not to.
- There should be a branch named after the distro for each distro it's for, e.g. `fedora` for Fedora.
- Must grab all assets locally, must not *require* getting packages from a URL, even if it's available publicly and easily.
  - Extra optional functionality like that is okay though.
  - i.e. can't grab from [here](https://askiiart.net/repos/archives/polycat/), must instead grab from `$COMPILED_DIR/polycat/`
- Must update the repo after building the package

---

For an example, see [polycat](https://git.askiiart.net/pkg-repo/polycat).