diff --git a/.github/workflows/edge.yml b/.github/workflows/deploy.yml similarity index 91% rename from .github/workflows/edge.yml rename to .github/workflows/deploy.yml index 99d1e68..5506f7a 100644 --- a/.github/workflows/edge.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,11 @@ -name: Edge Release +name: Main Deploy on: push: branches: [ main ] concurrency: - group: edge-release + group: main-deploy cancel-in-progress: false jobs: @@ -65,9 +65,9 @@ jobs: services: ${{ needs.changes.outputs.services }} secrets: inherit - # Then retag the changed multiarch images as edge - retag-edge: - name: Retag ${{ matrix.service }} as edge + # Then publish the changed multiarch images to the release tags used by k8s. + publish: + name: Publish ${{ matrix.service }} runs-on: ubuntu-latest needs: [changes, build] if: ${{ needs.changes.outputs.has_services == 'true' }} @@ -84,9 +84,8 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Retag as edge + - name: Publish release tags run: | REPO="audius/${{ matrix.service }}" SOURCE_TAG="${REPO}:${{ github.sha }}" - EDGE_TAG="${REPO}:edge" - docker buildx imagetools create "$SOURCE_TAG" --tag "$EDGE_TAG" + docker buildx imagetools create "$SOURCE_TAG" --tag "${REPO}:edge" --tag "${REPO}:latest" diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml deleted file mode 100644 index d30ff49..0000000 --- a/.github/workflows/latest.yml +++ /dev/null @@ -1,101 +0,0 @@ -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" diff --git a/BUILD.md b/BUILD.md index 53d01f7..f4b992a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -91,9 +91,8 @@ npm run docker:archiver # Build archiver ### CI/CD - Each app builds as a separate GitHub Actions job - Failures are isolated - one app failing doesn't affect others -- Pushes to `main` build and publish only apps with changes under their `apps/` directory +- Pushes to `main` build only apps with changes under their `apps/` directory, then publish those images as both `edge` and `latest` - PRs to `main` build all configured apps -- Can be manually triggered via workflow dispatch ## Troubleshooting