Skip to content

Merge branch 'main' into development #433

Merge branch 'main' into development

Merge branch 'main' into development #433

Workflow file for this run

# This workflow will perform following actions when the code is pushed to development branch:
# - Test linting with pylint.
# - Fetch Latest release.
# - Build the latest docker image in development which needs test to pass first.
# - Push the docker image to Docker Hub.
#
# Maintainers:
# - name: Nisha Sharma
# - email: [email protected]
name : Dev Build, Test and Publish
on:
push:
branches: [development]
env:
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_USERNAME }}
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
REPOSITORY_NAME: cheminformatics-microservice
REPOSITORY_NAMESPACE: nfdi4chem
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
# Login to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build and push main API Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:api-dev
# Check if frontend files have changed to optimize build process
- name: Check for frontend changes
uses: dorny/paths-filter@v2
id: frontend-changes
with:
filters: |
frontend:
- 'frontend/**'
# Build frontend Docker image only if frontend files changed
- name: Build and push frontend Docker image
uses: docker/build-push-action@v5
if: steps.frontend-changes.outputs.frontend == 'true'
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
build-args: |
REACT_APP_API_URL=https://dev.api.naturalproducts.net/latest
# REACT_APP_API_URL will use the default from frontend/Dockerfile (https://dev.api.naturalproducts.net/latest)
# If a specific one is needed for this dev build, add build-args here.
# build-args: |
# REACT_APP_API_URL=your-dev-frontend-api-url
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:app-dev