CI recipes
Complete workflows to copy into .github/workflows/. Each one logs in with orkestia/registry-login@v1, so no password or API key is stored in GitHub.
Before you start:
- The repository belongs to the GitHub organization connected to your Orkestia organization, and the registry is turned on.
- Replace
acmewith your namespace, andapi,my-librarywith your own names. - The examples assume the default rules: push from the default branch and from tags, pull only in pull requests. If your organization has its own rules, the publishing jobs must match a
pushrule.
Build and push a Docker image
Pushes on the default branch and on version tags. Pull requests build with the cache and do not push.
name: image
on:
push:
branches: [main] # your default branch
tags: ['v*']
pull_request:
permissions:
id-token: write
contents: read
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: orkestia/registry-login@v1
id: orkestia
with:
# Ask for push where the job may push, so a refusal shows here and names its reason.
scope: ${{ github.event_name == 'pull_request' && 'pull' || 'push' }}
python: "false"
npm: "false"
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ steps.orkestia.outputs.registry }}/api
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
- uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ steps.orkestia.outputs.registry }}/api:buildcache
cache-to: ${{ github.event_name != 'pull_request' && format('type=registry,ref={0}/api:buildcache,mode=max', steps.orkestia.outputs.registry) || '' }}
What each part does:
steps.orkestia.outputs.registryisregistry.orkestia.dev/<namespace>, so the workflow does not hard-code your namespace.- A pull request logs in with
pull. It reads the cache and builds, andcache-tois left empty because it cannot push. docker/setup-buildx-actioncreates a builder that can export the cache. It uses the Docker login from the step before.- The cache tag stays
buildcachefor every build. See Build cache for what the cache adds to stored data.
Pull it in another job
A later job logs in with pull and uses the image:
smoke:
needs: image
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: orkestia/registry-login@v1
id: orkestia
with:
scope: pull
python: "false"
npm: "false"
- run: docker run --rm ${{ steps.orkestia.outputs.registry }}/api:sha-${GITHUB_SHA::7} --version
type=sha in the metadata step tags each image sha- plus the first seven characters of the commit.
Publish and install a Python package
Publishes a wheel when you push a version tag, then installs it from your index in a second job. The version in pyproject.toml must match the tag you push.
name: python-package
on:
push:
tags: ['v*']
permissions:
id-token: write
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m pip install build twine
- run: python -m build
- uses: orkestia/registry-login@v1
id: orkestia
with:
scope: push
docker: "false"
npm: "false"
- run: |
twine upload \
--repository-url "${{ steps.orkestia.outputs.pip-upload-url }}" \
-u "$ORKESTIA_NAMESPACE" -p "$ORKESTIA_TOKEN" \
dist/*
install:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: orkestia/registry-login@v1
id: orkestia
with:
scope: pull
docker: "false"
npm: "false"
- run: pip install --extra-index-url "${{ steps.orkestia.outputs.pip-index-url }}" my-library
dist/* uploads the sdist and the wheel; pip installs the wheel and falls back to the sdist. See How versions are stored.
With uv
To build and publish with uv instead, replace the build and upload steps of publish:
- uses: astral-sh/setup-uv@v6
- run: uv build
- uses: orkestia/registry-login@v1
id: orkestia
with:
scope: push
docker: "false"
npm: "false"
- run: |
uv publish \
--publish-url "${{ steps.orkestia.outputs.pip-upload-url }}" \
--username "$ORKESTIA_NAMESPACE" --password "$ORKESTIA_TOKEN" \
dist/*
And to install with uv, replace the last step of install:
- uses: astral-sh/setup-uv@v6
- run: uv pip install --system --extra-index-url "${{ steps.orkestia.outputs.pip-index-url }}" my-library
uv reads the same credentials as pip, from the netrc file the login step writes.
Publish and install an npm package
The package is named @acme/my-library in package.json: npm packages on Orkestia always use your namespace as their scope. Publishes when you push a version tag; the version in package.json must match.
name: npm-package
on:
push:
tags: ['v*']
permissions:
id-token: write
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# setup-node first: the login step then adds its lines to the same .npmrc.
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: orkestia/registry-login@v1
with:
scope: push
docker: "false"
python: "false"
- run: npm ci
- run: npm publish
install:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: orkestia/registry-login@v1
with:
scope: pull
docker: "false"
python: "false"
- run: npm install @acme/my-library
Only @acme/... packages come from your namespace. Every other package still comes from the public npm registry. Do not set publishConfig.registry in package.json to another registry, or npm publish goes there instead.
Several jobs, one login each
The token lives in the job that ran the login step. Each job that pulls or pushes runs the step itself, as in the install and smoke jobs above. A job that runs longer than an hour runs the step again before it pushes.
See also
- Log in from GitHub Actions: inputs, outputs and trust rules.
- Troubleshooting: what each refusal means.
Build cache
Keep the BuildKit layer cache in your Orkestia Registry namespace so image builds reuse layers between runs, with one cache tag per image.
Troubleshooting
Every refusal you can see from Orkestia Registry and the package index — the GitHub Actions login step, Docker, pip, uv, twine and npm — with its cause and the fix.
