Skip to content

Appearing spinner after logging in (#5742) #1581

Appearing spinner after logging in (#5742)

Appearing spinner after logging in (#5742) #1581

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# OpenCRVS is also distributed under the terms of the Civil Registration
# & Healthcare Disclaimer located at http://opencrvs.org/license.
#
# Copyright (C) The OpenCRVS Authors. OpenCRVS and the OpenCRVS
# graphic logo are (registered/a) trademark(s) of Plan International.
name: Publish images to Dockerhub from any branch
on:
workflow_dispatch:
inputs:
branch_name:
description: Branch to build from
default: develop
required: true
push:
branches:
- 'develop'
- 'release-v1.4.0'
jobs:
base:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ github.event.inputs.branch_name }}'
- uses: actions/checkout@v2
if: github.event_name == 'push'
- name: Set version
id: set-version
run: |
export VERSION=`git log -1 --pretty=format:%h`
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Get list of services
id: get-services
run: |
services=$(grep "^ [^ ]" docker-compose.yml | 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: Build base image
id: base-image
run: |
yarn build:image
- name: Tag image with version
run: |
docker image tag opencrvs-build:latest opencrvs-build:${{ steps.set-version.outputs.version }}
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: 'opencrvs-build:${{ steps.set-version.outputs.version }}'
outputs:
services: ${{ steps.get-services.outputs.services }}
version: ${{ steps.set-version.outputs.version }}
build:
needs: base
strategy:
matrix:
service: ${{ fromJSON(needs.base.outputs.services) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ github.event.inputs.branch_name }}'
- uses: actions/checkout@v2
if: github.event_name == 'push'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: 'opencrvs-build:${{ needs.base.outputs.version }}'
- name: Rename image to latest
run: |
docker image tag opencrvs-build:${{ needs.base.outputs.version }} opencrvs-build:latest
- name: Build ${{ matrix.service }}
run: |
echo ${{ matrix.service }}
export VERSION=`git log -1 --pretty=format:%h`
docker-compose build ${{ matrix.service }}
docker-compose push ${{ matrix.service }}