Skip to content

Commit

Permalink
Merge pull request #8059 from opencrvs/v1.6.0-hotfix-builds
Browse files Browse the repository at this point in the history
Hotfix builds by matching them to branch builds
  • Loading branch information
n1koo authored Nov 22, 2024
2 parents ed1b685 + 7ddcb31 commit 3ee08d8
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,37 @@ jobs:
- name: Get list of services
id: get-services
run: |
services=$(grep "^ [^ ]" docker-compose.yml | grep -v '#' | awk -F: '{print $1}' | sed -e 's/^ *//')
services=$(grep "^ [^ ]" docker-compose.yml | grep -v base| grep -v '#' | awk -F: '{print $1}' | sed -e 's/^ *//')
services_json=$(echo $services | tr '\n' ',' | sed 's/,$//' | jq -R 'split(" ")' | tr -d '\n')
# Set the list of service names as an output variable
echo "services=$services_json" >> $GITHUB_OUTPUT
echo "services=$services_json"
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push base image
uses: docker/build-push-action@v6
with:
file: packages/Dockerfile.base
context: .
push: true
tags: |
opencrvs/ocrvs-base:${{ steps.set-version.outputs.version }}
cache-from: type=registry,ref=opencrvs/ocrvs-base:${{ steps.set-version.outputs.version }}
cache-to: type=inline

outputs:
services: ${{ steps.get-services.outputs.services }}
version: ${{ steps.set-version.outputs.version }}

build:
needs: base
strategy:
fail-fast: false
matrix:
service: ${{ fromJSON(needs.base.outputs.services) }}
runs-on: ubuntu-22.04
Expand All @@ -74,17 +92,23 @@ jobs:
if: github.event_name == 'push'

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build ${{ matrix.service }}
run: |
echo ${{ matrix.service }}
export VERSION=${{ github.event.inputs.release_version }}
docker compose build ${{ matrix.service }}
docker compose push ${{ matrix.service }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: packages/${{ matrix.service }}/Dockerfile
build-args: |
VERSION=${{ needs.base.outputs.version }}
push: true
context: .
tags: |
opencrvs/ocrvs-${{ matrix.service }}:${{ needs.base.outputs.version }}
cache-from: type=registry,ref=opencrvs/ocrvs-${{ matrix.service }}:${{ needs.base.outputs.version}}
cache-to: type=inline

security-scans:
needs: [base, build]
Expand Down

0 comments on commit 3ee08d8

Please sign in to comment.