Release from GitHub Actions
Let your own GitHub Actions workflow build, check and approve the image, then roll out exactly that digest. No stored secret, and a rollback is a release of an earlier state.
Currently available on selected dedicated instances. Coming to the shared platform next.
An app reaches nyxory on one of several ways. By default nyxory builds the image itself on every push, see Deploy on push. With the trigger GitHub Actions, your workflow builds and checks the image, pushes it into the project’s registry and tells nyxory which commit and digest go live. For any other CI there is the trigger Pipeline with a deploy token, see Release from any CI. The trigger is set per app, and one excludes the others.
| Push (default) | GitHub Actions | |
|---|---|---|
| Who builds the image | nyxory, from the pushed commit | your workflow |
| Checks before the release | the platform’s scan | your tests, scan, SBOM or signature, and the platform’s scan |
| Approval before production | none | a protected GitHub environment with required reviewers |
| What goes live | the image built from the commit | exactly the digest your workflow pushed |
| What you maintain | nothing | the workflow |
Stay on push when nobody asks for more. Switch to GitHub Actions when your release process needs its own checks or an approval in GitHub, or when the digest you tested has to be the one that runs.
Switch the trigger
The trigger sits on the app page in the console, in the Auto-deploy panel where the branch is set:
- Connect the repo through the nyxory GitHub App and deploy the app once, as for deploy on push. Apps from other Git hosts stay on push or take the trigger Pipeline.
- Switch Trigger from Push to GitHub Actions. Only project admins can, and only on instances where registry access is set up. Otherwise the switch is greyed out with the reason.
- Optionally set a GitHub environment, see Approval before production.
- Copy the workflow for this app. It is the workflow below with your project, app and API URL filled in. Add it to the repo as
.github/workflows/release.yml.
A platform build that is already running finishes. After that nyxory no longer builds the app, and only releases from your workflow roll it out. Switching back to push builds the current head of the branch and rolls it out.
The workflow
# .github/workflows/release.yml
name: release
on: { push: { branches: [main] } }
permissions: { contents: read, id-token: write }
defaults: { run: { shell: bash } } # bash with pipefail: a failing nyx call stops the step
jobs:
release:
runs-on: ubuntu-latest
environment: production # optional, see "Approval before production"
env: { NYX_API_URL: https://api.<instance>.nyxory.eu } # exactly your instance's API URL
steps:
- uses: actions/checkout@v7
- run: curl -fsSL https://nyxory.com/install.sh | NYX_INSTALL_ONLY=1 bash
- run: nyx registry login nyx-abc123 web --json | jq -r '"REPO=\(.data.repository)", "REGISTRY=\(.data.registry)"' >> "$GITHUB_ENV"
- uses: docker/setup-buildx-action@v4
- id: build
uses: docker/build-push-action@v7
with: { context: ., push: true, tags: "${{ env.REPO }}:${{ github.sha }}" }
# your scan, SBOM and signature on ${{ steps.build.outputs.digest }}
- run: nyx release nyx-abc123 web --image "$REPO@${{ steps.build.outputs.digest }}"
- if: always() && env.REGISTRY != ''
run: docker logout "$REGISTRY"
Replace nyx-abc123 with your project ID and web with the app name. What each part does:
id-token: writelets the job request a GitHub OIDC token. ThenyxCLI fetches a fresh one for every call, with the API URL inNYX_API_URLas its audience.NYX_API_URLhas to be exactly your instance’s API URL, and the workflow you copy from the console has it filled in. You set noNYX_TOKENand store no secret in GitHub.nyx registry loginasks nyxory for a push credential for this run and logs Docker in, with the password on stdin and never on a command line. With--jsonit returnsregistry,repositoryandexpires_at, and the step keeps the repository and the registry for the later steps.- The build pushes the image tagged with the commit SHA, so every image in the registry traces back to its commit.
- Your checks run on
steps.build.outputs.digest, the digest that will run. A failing check stops the job before anything is released. nyx releaseasks nyxory to roll out this commit with this digest and waits until it is live.--commitdefaults toGITHUB_SHA, and--imagehas to be pinned by digest (<repository>@sha256:…).docker logoutremoves the credential from the runner at the end, also when an earlier step failed.
nyx release exits with 0 when the release is live, with 1 when it failed or was refused, superseded or replaced, and prints status and reason. It exits with 2 when the release is still running after --timeout (default 15m). The release then continues on nyxory, and nyx app releases nyx-abc123 web shows where it stands. With --no-wait the job ends as soon as the release is accepted.
Which workflow events may release
Only runs started by push or workflow_dispatch get a registry credential or a release. Every other event is refused with event_not_allowed. Both kinds of run work on a commit of the branch they were started for, and that branch has to be the app’s. A re-run of an earlier push run keeps its event, so re-running stays a way back.
Do not route a release through workflow_run, pull_request_target or issue_comment. Those runs carry the base repository’s rights and its default branch, but something from outside starts them, a pull request from a fork or a comment. A workflow that then checks out and builds that code would release code nobody reviewed. nyxory refuses these events for that reason. Plain pull-request runs carry refs/pull/… and fail the branch check as well.
What a release does
nyxory checks the request, applies deploy/ from the released commit with your digest as IMAGE_REF, runs a dry run of every object and only then writes and rolls out. Without deploy/, the app’s container gets the new image. A folder that breaks a rule refuses the release, and the running version keeps serving, see Configure your app from the repo.
A release is queued, then rolling_out, then live, or it ends as failed with the reason. superseded means a newer release arrived before this one started. replaced means it was live and a newer one is live now, or the platform rolled it back after errors rose. refused means the request came from your repository but broke a rule, with the reason. Per app one release runs at a time and at most one waits, and a newer request replaces the waiting one.
The history is on the app page under Releases, above the rollout history, in nyx app releases, and for your coding agent in nyx_app_get with view: releases. Each entry carries the commit, the image, the source, the GitHub login that started the run and a link to the run.
Approval before production
The approval lives in GitHub. Create an environment such as production under the repository’s Settings → Environments and add Required reviewers. A job that declares environment: production then waits until a reviewer approves, and only then runs nyx release.
To make nyxory insist on it, set GitHub environment on the app to production. A run from any other environment, or from none, is then refused with environment_mismatch.
Several Deployments in one release
One release carries exactly one image. Every Deployment in the app’s deploy/ that writes image: IMAGE_REF gets that digest in the same release, a web process and a worker that run the same image with a different command, for example. Put both in one app’s deploy/ and they always run the same commit, see Configure your app from the repo. A worker built from its own image stays a separate app with its own release step.
Roll back
A rollback is a release of an earlier state, its commit and its image. A release by hand, from the console, the CLI with a user token or your coding agent, can only bring back such an earlier entry of the app’s history, commit and image together. Anything else is refused with not_in_history, because new images only come from the pipeline. There are four ways:
- Console: Back to this state on an earlier entry under Releases.
- CLI:
nyx release nyx-abc123 web --commit <commit> --image <image> --pause, with the values fromnyx app releasesand a user token fromnyx loginorNYX_TOKEN. - Coding agent:
nyx_releasewithproject,name,commitandimage. - GitHub: re-run the workflow run of that commit. It builds and releases that commit again.
A rollback from the console pauses automatic releases, so the next push or pipeline run does not undo it. --pause does the same from the CLI, and it takes a user token, not the pipeline’s. While releases are paused, a release from the workflow is refused with releases_paused. A project admin resumes them on the app page, or through the API with PATCH /api/apps/<project>/<app>/deploy-config and {"releases_paused": false}.
A rollback applies deploy/ from the old commit. Nothing is pruned, so fields only the newer state set stay in place, and database migrations are not reverted.
The registry keeps the newest 10 images per repository plus every image a running workload or its recent rollout history still uses. Older images are removed whatever their tags, so a rollback reaches back that far. The console shows when an image is gone, and a release of it is refused with image_not_found.
When a release is refused
Every refusal has its own code, and the message names the expected value, the branch or the audience for example. nyx release prints both and a hint.
For a call from a workflow, a repository that is not connected to the app, an app that does not exist and an app whose trigger is not GitHub Actions all get the same 404 not_found, so nobody can probe which apps exist. The other codes apply once the repository matches.
| Code | HTTP | Meaning | Fix |
|---|---|---|---|
not_found |
404 | no app with this project and name for this repository, or its trigger is not GitHub Actions | check NYX_API_URL, project and app, and the app’s trigger and repository |
oidc_invalid |
401 | the token’s signature, issuer, expiry or audience is wrong | set NYX_API_URL to your instance’s API URL, the message names it, and grant id-token: write |
oidc_unavailable |
503 | nyxory could not reach GitHub’s signing keys | re-run the job |
ci_unavailable |
503 | the instance has no API URL configured for pipeline releases | ask us to set it up |
event_not_allowed |
403 | the run was not started by push or workflow_dispatch |
release from a push or workflow_dispatch workflow, see Which workflow events may release |
branch_mismatch |
403 | the run is not on the app’s branch | release from that branch, the message names it |
environment_mismatch |
403 | the app requires a GitHub environment the job did not run in | set environment: on the job |
binding_principal_lost |
403 | the person who connected the repo no longer has access to the project | a project admin reconnects the repo |
commit_mismatch |
422 | --commit is not the commit of this run |
leave out --commit in GitHub Actions |
image_outside_project |
422 | the image is not in the project’s registry or not pinned by digest | pass the repository from nyx registry login with the pushed digest |
image_not_found |
422 | the digest is not in the registry | push first, or the image was removed, see Roll back |
not_in_history |
422 | a release by hand names a commit and image that are not an earlier entry of the app’s history | pick an entry from nyx app releases; new images come from the pipeline |
releases_paused |
409 | releases are paused after a rollback | a project admin resumes them |
registry_unavailable |
503 | the registry is unreachable or not set up on this instance | retry later, or ask us to set it up |
too_many_credentials |
429 | the project already has 10 active registry credentials | retry later, they expire within the hour |
rate_limited |
429 | more than 30 release requests per app per minute | retry in a minute |
How access is secured
- No stored secret. Neither nyxory nor GitHub holds a credential for this. The job proves who it is with a GitHub OIDC token per call, valid for minutes.
- Bound to the repository, the branch and the environment. nyxory checks the repository ID, not its name, so a renamed or transferred repository keeps working, while a fork or a repository deleted and created again under the same name has a new ID and is refused. The run has to be on the app’s branch, started by
pushorworkflow_dispatchand, when set, in its GitHub environment. - One audience per instance. The token names your instance’s API URL, so a token for one instance is refused on every other.
- No more rights than the person who connected the repo. A release runs with that person’s rights. When they lose access to the project, releases stop with
binding_principal_lost. - A short-lived registry credential. It is issued per run, can push and pull in the project’s registry only, and is valid for at most 70 minutes, at most 10 at a time per project. The password appears once, in the answer to the run, and nyxory does not store it. The workflow logs Docker out at the end.
- Only the release calls accept the GitHub token. Requesting a registry credential and requesting or following a release. Every other API call refuses it, so the job cannot read secrets or change anything else.
- Images come from the project’s registry only. Images from other registries are refused, because the scan and the bill of materials per digest need the image there, see Security scanning.
Not here yet
- checking an image signature before the release
Tell us which you need.
Related: Release from any CI · Deploy on push · Configure your app from the repo · nyx CLI reference