@nersh/publish
v0.1.0
Published
Upload a static export to a nertia code site: manifest, files straight to storage, finalize
Maintainers
Readme
@nersh/publish
Uploads a static export (a folder with index.html at its root) to a nertia code site in three calls: it hashes the folder and sends the manifest, puts each file nertia does not hold yet straight to storage through the signed address nertia answers, then finalizes, which writes the release and moves the preview to it. It never puts a site live. It reads the repository, commit, ref and run id from the GitHub Actions environment and the token from NERTIA_PUBLISH_TOKEN (mint one on the site Settings and store it as a repository secret).
# .github/workflows/nertia-publish.yml
name: Publish to nertia
on:
push: { branches: [main] }
workflow_dispatch: { inputs: { ref: { description: 'ref to build', required: false } } }
permissions: { contents: read }
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with: { ref: ${{ inputs.ref || github.ref }} }
- uses: actions/setup-node@v5
with: { node-version: 22, cache: npm }
- run: npm ci && npm run build && test -f out/index.html
- run: npx @nersh/publish out --site ${{ vars.NERTIA_SITE }}
env:
NERTIA_PUBLISH_TOKEN: ${{ secrets.NERTIA_PUBLISH_TOKEN }}From a laptop:
NERTIA_PUBLISH_TOKEN=... npx @nersh/publish out --site <slug> --repo owner/name --commit $(git rev-parse HEAD) --ref main