GitHub Action
relay-deploy builds your Dockerfile, pushes the image to your registry and hands the deployment to Relay.
What it does
The relay-deploy action runs as a step in your GitHub workflow. On each run it:
- Attaches the build to the deployment named by
relay-deployment-id. If that input is empty, it queues a new deployment for the repository, branch and commit that triggered the run. - Requests a push token for that deployment from Relay.
- Logs in to the registry named by the push token. If the token has no credentials, it uses the
registry-tokeninput instead. - Builds your Dockerfile for
linux/amd64andlinux/arm64and pushes the image. - Reports
succeededwith the image tag to Relay. If any step fails, it reportsfailedwith the workflow run URL and exits with an error.
The action only builds and pushes. What happens to the image after that is covered inthe deploy loop.
Usage
This is the workflow Relay generates for a project, using the action reference divquan/relay-deploy@v1. It runs on pushes to the project's branch and on manual dispatch, and it reads two repository secrets:RELAY_API_URL and RELAY_DEPLOY_KEY.
name: relay-deploy
on:
push:
branches: ['main']
workflow_dispatch:
inputs:
relay_deployment_id:
type: string
required: false
permissions:
contents: read
packages: write
jobs:
relay:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: relay-deploy
uses: divquan/relay-deploy@v1
with:
relay-api-url: ${{ secrets.RELAY_API_URL }}
relay-deploy-key: ${{ secrets.RELAY_DEPLOY_KEY }}
relay-deployment-id: ${{ github.event.inputs.relay_deployment_id }}
registry-token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
The generated workflow passes the run's GITHUB_TOKEN as registry-token and grantspackages: write, for the case where Relay's push token carries no credentials of its own.
Inputs
| Name | Required | Default | Description |
|---|---|---|---|
relay-api-url | yes | — | Control plane base URL |
relay-deploy-key | yes | — | Short-lived deploy key issued by the relay dashboard |
relay-deployment-id | no | — | Deployment record to attach the build to. The action self-queues when omitted. |
dockerfile | no | Dockerfile | Path to the Dockerfile relative to the workspace |
registry-token | no | — | Token for docker login on the registry named by the push token; for ghcr pass the workflow's runtime GitHub token |
Outputs
| Name | Description |
|---|---|
image-tag | Fully qualified image tag that was pushed |
Read it in a later step with ${{ steps.<step-id>.outputs.image-tag }}, where<step-id> is the id you give the step that uses the action.