> For AI agents: the complete documentation index is available at /en/llms.txt, the full documentation bundle is available at /en/llms-full.txt.

# Build it yourself with GitHub Actions

If you want to build the site yourself — with your own Hugo version, npm,
Tailwind, a tool other than Hugo or your own test suite — you can do it in your
CI and send the finished result to us. We publish it exactly as it is.

Everything else works as usual: your own domain, HTTPS, domain verification,
saved versions and an email if something goes wrong.

There are two ways. **Upload** is the simplest: your workflow sends the finished
site straight to us. If you would rather have us fetch it from your repository,
that works too, via a dedicated branch.

## Option 1: Upload (recommended) \{#satt-1-ladda-upp-rekommenderas}

```
git push  ──▶  GitHub Actions builds  ──▶  uploads to us  ──▶  published
```

We don't need any access to your repository at all — no deploy key and no
webhook.

### 1. Add the upload address as a secret \{#1-lagg-uppladdningsadressen-som-en-hemlighet}

The upload address is shown under your service in the portal
(**Services → GetGeek Static → Upload URL**). Add the last part of the address —
the key after `/upload/<site>/` — as a secret in your repository:
**Settings → Secrets and variables → Actions → New repository secret**, with the
name `GETGEEK_UPLOAD_TOKEN`.

:::warning The upload key controls what your site shows
Unlike the webhook address, this key can change the content of your site. Only
store it as a secret in GitHub, never in a file in the repository. If you think
it has leaked, press **Ny webhook- och uppladdningsnyckel** (new webhook and upload key) on the service page. The old key stops working when the change is done, normally within 1–2 minutes.
:::

### 2. Add a workflow \{#2-lagg-till-ett-workflow}

```yaml title=".github/workflows/deploy.yml"
name: Bygg och publicera

on:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          submodules: true

      - uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: "0.165.0"
          extended: true

      - run: hugo --minify

      - name: Publicera hos GetGeek Static
        env:
          UPLOAD_URL: https://static.getgeek.se/upload/<sajt>/${{ secrets.GETGEEK_UPLOAD_TOKEN }}
        run: |
          tar -C public -czf site.tar.gz .
          curl --fail-with-body -sS --data-binary @site.tar.gz "$UPLOAD_URL"
```

Replace `<sajt>` with your site name (it is in the upload address in the
portal). You can change the build step freely — all we care about is the
archive: a `tar.gz` with the finished site and `index.html` at the top level.

The workflow only needs **read access** to the repository (`contents: read`),
since nothing is pushed back.

### Good to know about uploading \{#bra-att-veta-om-uppladdning}

- **Response `202`** = received, the site is published within a few seconds.
  `403` = wrong key, `413` = the archive is larger than 1 GB, `415` = not a
  `tar.gz` archive.
- **If publishing fails** — for example if `index.html` is missing — you get an
  email, and your site keeps showing the latest working version.
- **Symbolic links are never published.** An archive containing any is rejected.
- **The same archive twice** does not create a new version.
- It works the same from **any CI system** and from your own computer — it is an
  ordinary HTTP request.

## Option 2: Via the gh-pages branch \{#satt-2-via-grenen-gh-pages}

```
git push  ──▶  GitHub Actions builds  ──▶  the gh-pages branch  ──▶  we publish the files
```

Here your workflow pushes the result to a branch in your repository, and we
fetch it with the deploy key. This suits you if you want the built site
versioned in git.

### 1. Add a workflow (gh-pages) \{#1-lagg-till-ett-workflow-gh-pages}

Create the file `.github/workflows/deploy.yml` in your repository:

```yaml title=".github/workflows/deploy.yml"
name: Bygg och publicera

on:
  push:
    branches: [main]

permissions:
  contents: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          submodules: true

      - uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: "0.165.0"
          extended: true

      - run: hugo --minify

      - uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public
          publish_branch: gh-pages
```

The workflow builds the site on every push to `main` and puts the finished
result in the `gh-pages` branch. Feel free to replace the build step with
whatever you like — all we care about is that `gh-pages` contains the finished
site, with `index.html` at the top level.

:::info What is `GITHUB_TOKEN` used for?
Only inside GitHub, so that the workflow can push the built site to the
`gh-pages` branch in your own repository.

- It is not a secret you create yourself. GitHub automatically creates a token
  for each run, and it expires when the job is finished.
- It only applies to your repository, with the permissions the workflow asks
  for. That is why the file says `permissions: contents: write` — the step that
  pushes to `gh-pages` needs write access.
- **It never leaves GitHub, and GetGeek never sees it.** Our access to your
  repository is only the deploy key, which is read-only. We fetch `gh-pages`
  after GitHub has pushed to it.

If you don't want to give the workflow write access via `GITHUB_TOKEN`,
`actions-gh-pages` can use a deploy key of your own with write access instead
(`deploy_key:` instead of `github_token:`). The result is the same, but it is one
more key to keep track of.
:::

### 2. Choose the mode _Pre-built branch in the repo_ \{#2-tala-om-for-oss-att-sajten-ar-fardigbyggd}

Choose _Pre-built branch in the repo_ in the order,
or switch later with the link **Uppgradera/nedgradera** (upgrade/downgrade) under _Hur publicerar ni sajten?_ on the service page (free). Leave
_Branch_ empty for `gh-pages`. The site is then set up so that we just
copy the branch.

### 3. Deploy key, webhook and DNS \{#3-deploynyckel-webhook-och-dns}

Just as usual — see [Connect GitHub](/en/static/github.md) and
[Getting started](/en/static/kom-igang.md#steg-4-dns). The webhook should send on push.

### Good to know about gh-pages \{#bra-att-veta-om-gh-pages}

- **GitHub sends the webhook for pushes to all branches.** When you push to
  `main` we hear about it straight away, but see that `gh-pages` hasn't changed
  yet and do nothing. When your workflow then pushes to `gh-pages`, we publish.
  Allow half a minute from push to published site.
- **Publishing is a plain copy.** The `.nojekyll` file that the workflow puts in
  the branch comes along but makes no difference.
- **Don't set `cname`** in `actions-gh-pages` — it applies to GitHub Pages, not
  to us.
- **If your build fails**, you see it in GitHub (the _Actions_ tab), not in an
  email from us: the `gh-pages` branch is then not changed, and your site keeps
  showing the latest version.
- **Other CI systems** work the same way — GitLab CI, Gitea Actions and others —
  as long as the result is pushed to a dedicated branch in the repository.
