Skip to content

Commit

Permalink
Update builds to run separately
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakycrow committed Nov 9, 2024
1 parent 7b7b884 commit e1ceca0
Showing 1 changed file with 69 additions and 15 deletions.
84 changes: 69 additions & 15 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ on:
workflow_dispatch:

jobs:
build-and-push:
# Common setup job to get commit hash
setup:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -22,6 +21,17 @@ jobs:
id: version
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

# API image build job
build-api:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
Expand All @@ -33,7 +43,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Build and push API image
- name: Build and push API image
uses: docker/build-push-action@v5
with:
Expand All @@ -43,9 +52,33 @@ jobs:
platforms: linux/amd64
tags: |
${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:latest
${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:${{ needs.setup.outputs.version }}
- name: Image digest
run: echo "API image digest $(doctl registry repository digest-list ${{ vars.API_IMAGE }} --format Tag,Digest --no-header | grep latest)"

# Queue image build job
build-queue:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_REGISTRY_KEY }}

- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Build and push Queue image
- name: Build and push Queue image
uses: docker/build-push-action@v5
with:
Expand All @@ -55,9 +88,33 @@ jobs:
platforms: linux/amd64
tags: |
${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:latest
${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:${{ needs.setup.outputs.version }}
- name: Image digest
run: echo "Queue image digest $(doctl registry repository digest-list ${{ vars.QUEUE_IMAGE }} --format Tag,Digest --no-header | grep latest)"

# UI image build job
build-ui:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_REGISTRY_KEY }}

- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Build and push UI image
- name: Build and push UI image
uses: docker/build-push-action@v5
with:
Expand All @@ -67,10 +124,7 @@ jobs:
platforms: linux/amd64
tags: |
${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:latest
${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:${{ needs.setup.outputs.version }}
- name: Image digest
run: |
echo "API image digest: $(doctl registry repository digest-list ${{ vars.API_IMAGE }} --format Tag,Digest --no-header | grep latest)"
echo "Queue image digest: $(doctl registry repository digest-list ${{ vars.QUEUE_IMAGE }} --format Tag,Digest --no-header | grep latest)"
echo "UI image digest: $(doctl registry repository digest-list ${{ vars.UI_IMAGE }} --format Tag,Digest --no-header | grep latest)"
run: echo "UI image digest $(doctl registry repository digest-list ${{ vars.UI_IMAGE }} --format Tag,Digest --no-header | grep latest)"

0 comments on commit e1ceca0

Please sign in to comment.