# Publishing to the Aerostack Hub

> Choose the right publishing workflow for your team — Admin, CLI, GitHub Actions, or GitLab CI.

You can **create** and **publish** community functions in four ways: the **Admin** dashboard (web editor), the **CLI** (direct push), **GitHub Actions**, or **GitLab CI**. See the [Function Flow Overview](/hub/function-flow-overview) for the full lifecycle.

---

## Choose a publishing method

**Admin** — Create and edit functions in the browser, then publish. No local setup. Go to [Admin](https://app.aerostack.dev) → **My Functions**. You can also finalize drafts created via CLI here (add README, tags, then click Publish).

  ` to go live. No CI setup required." />
  
  

---

## What happens when you publish

- **Admin / CLI push**: Creating a function always starts as a **draft**. Each `aerostack functions push` **creates a new draft** (it does not update an existing function by slug). To update an existing function from the CLI workflow, use the Admin to edit, or use CI.
- **CI** (`POST /api/community/functions/ci/publish`): **Upserts** by slug — if a function with the same name/slug already exists under your account, its code and metadata are updated; otherwise a new function is created. Set `publish: true` in the body to make it live immediately.

Common pipeline steps:

1. **Validate** — `aerostack.json` (or request body) is checked for name, category, code, etc.
2. **Create or upsert** — Admin/CLI: create only. CI: upsert by (developer, slug).
3. **Snapshot** — When a function is published, the current code is stored as a version snapshot.
4. **Go live** — Status changes to `published` when you click Publish in Admin, run `aerostack functions publish <id>`, or pass `publish: true` in CI.

  **Drafts are safe** — Publishing always starts as a `draft` unless you explicitly pass `publish: true` (CI) or click **Publish** in the Admin. You can add a README and tags before making it public.

---

## Version History

Every time you publish a new version, a snapshot is stored — **all past versions are preserved**. Consumers who installed an earlier version can still reference its code.

You cannot overwrite a past version's snapshot. To update a function, always bump the `version` field in `aerostack.json` first.

---

## The `aerostack.json` config

All three workflows read from the same `aerostack.json` file in your function directory. See the [CLI guide](/hub/publish-cli#the-aerostackjson-file) for the complete field reference.

```json title="aerostack.json (minimal)"
{
  "name": "my-function",
  "version": "1.0.0",
  "description": "One clear sentence about what this does.",
  "category": "utility",
  "language": "typescript",
  "runtime": "cloudflare-worker",
  "license": "MIT",
  "entrypoint": "index.ts"
}
```
