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:

  1. 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.
  2. Requests a push token for that deployment from Relay.
  3. Logs in to the registry named by the push token. If the token has no credentials, it uses theregistry-token input instead.
  4. Builds your Dockerfile for linux/amd64 and linux/arm64 and pushes the image.
  5. Reports succeeded with the image tag to Relay. If any step fails, it reportsfailed with 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

NameRequiredDefaultDescription
relay-api-urlyes—Control plane base URL
relay-deploy-keyyes—Short-lived deploy key issued by the relay dashboard
relay-deployment-idno—Deployment record to attach the build to. The action self-queues when omitted.
dockerfilenoDockerfilePath to the Dockerfile relative to the workspace
registry-tokenno—Token for docker login on the registry named by the push token; for ghcr pass the workflow's runtime GitHub token

Outputs

NameDescription
image-tagFully 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.