# `mix tinfoil.publish`
[🔗](https://github.com/joshrotenberg/tinfoil/blob/v0.2.22/lib/mix/tasks/tinfoil.publish.ex#L1)

Create a GitHub Release for the current tag and upload every
archive and checksum file found under the input directory.

Designed to run on a single CI runner after all matrix builds
finish and archives are downloaded into one place. The generated
workflow calls it this way:

    - name: Publish
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: mix tinfoil.publish --input-dir artifacts

## Auth

Requires `GITHUB_TOKEN` (GitHub Actions provides this automatically)
with `contents: write` permission on the target repository.

## Flags

  * `--input-dir` — directory containing archives + sidecars
                    (default `artifacts`)
  * `--tag`       — the release tag, e.g. `v1.2.3`. Defaults to
                    `GITHUB_REF_NAME`, which CI sets for tag pushes.
  * `--draft`     — create the release as a draft
  * `--attach`    — upload to the release that already exists for
                    this tag instead of creating one, leaving its
                    body, prerelease flag, and draft state alone.
                    Errors if no release exists. For projects where
                    something else (release-please, changesets)
                    already creates the release.
  * `--replace`   — if a release for this tag already exists,
                    delete it (and its assets) and create a fresh
                    one. The git tag itself is untouched. Intended
                    for development / force-retag iteration loops,
                    not for released versions.
  * `--dry-run`   — print what would be published (repo, tag,
                    draft/prerelease flags, asset list + sizes)
                    and exit without touching the GitHub API.

`--attach` and `--replace` are mutually exclusive: one preserves the
existing release, the other destroys it.

Pre-release detection is automatic: tags containing `-rc`, `-beta`,
or `-alpha` are marked as prerelease in the created release. In
`--attach` mode the existing release's prerelease flag is left as
whatever the creating tool set.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
