Skip to content

Release Latest

Release Latest #32

Workflow file for this run

name: Release Latest
on:
workflow_dispatch:
inputs:
commit_sha:
description: 'Commit SHA to tag as latest (defaults to main)'
required: false
type: string
service:
description: 'Service to promote (leave empty to promote all 13)'
required: false
type: string
concurrency:
# Single-service runs don't need to block multi-service runs and vice versa.
group: latest-release-${{ inputs.service || 'all' }}
cancel-in-progress: false
jobs:
# Setup services matrix
setup:
name: Setup services matrix
runs-on: ubuntu-latest
outputs:
services: ${{ steps.setup-services.outputs.services }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup services matrix
id: setup-services
shell: bash
run: |
if [ -n "${{ inputs.service }}" ]; then
# Validate the service exists in the canonical list before promoting.
if ! jq -e --arg s "${{ inputs.service }}" 'index($s) != null' .github/config/services.json > /dev/null; then
echo "Error: '${{ inputs.service }}' is not a known service. Allowed:" >&2
jq -r '.[]' .github/config/services.json >&2
exit 1
fi
SERVICES=$(jq -c -n --arg s "${{ inputs.service }}" '[$s]')
else
SERVICES=$(jq -c . .github/config/services.json)
fi
echo "services=$SERVICES" >> "$GITHUB_OUTPUT"
# Verify edge images exist for the specified commit
verify-edge:
name: Verify edge images exist
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
service: ${{ fromJson(needs.setup.outputs.services) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Login
uses: ./.github/actions/docker-login
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Verify source image exists
run: |
COMMIT_SHA="${{ inputs.commit_sha || github.sha }}"
SOURCE_TAG="audius/${{ matrix.service }}:$COMMIT_SHA"
if ! docker manifest inspect "$SOURCE_TAG" > /dev/null 2>&1; then
echo "Error: Image $SOURCE_TAG does not exist. Make sure the edge build completed successfully for commit $COMMIT_SHA"
exit 1
fi
echo "✅ Verified $SOURCE_TAG exists"
# Retag edge images as latest
retag-latest:
name: Tag ${{ matrix.service }} as latest
runs-on: ubuntu-latest
needs: [setup, verify-edge]
strategy:
matrix:
service: ${{ fromJson(needs.setup.outputs.services) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Login
uses: ./.github/actions/docker-login
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Retag as latest
run: |
COMMIT_SHA="${{ inputs.commit_sha || github.sha }}"
REPO="audius/${{ matrix.service }}"
SOURCE_TAG="${REPO}:$COMMIT_SHA"
LATEST_TAG="${REPO}:latest"
docker buildx imagetools create "$SOURCE_TAG" --tag "$LATEST_TAG"
echo "✅ Tagged $SOURCE_TAG as $LATEST_TAG"