Skip to content

Merge branch 'CI-CD-updates' of https://github.com/NFDI4Chem/nmrkit i… #74

Merge branch 'CI-CD-updates' of https://github.com/NFDI4Chem/nmrkit i…

Merge branch 'CI-CD-updates' of https://github.com/NFDI4Chem/nmrkit i… #74

Workflow file for this run

Check failure on line 1 in .github/workflows/dev-build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/dev-build.yml

Invalid workflow file

(Line: 32, Col: 3): The workflow must contain at least one job with no dependencies.
# This workflow will perform following actions when code is pushed to the development branch:
# - Run tests and linting checks (can be enabled via needs: test_and_lint)
# - Build and push nmrKit Docker image with layer caching for faster builds
# - Conditionally build nmr-cli image only if files in app/scripts/nmr-cli/ changed
# - Push images to Docker Hub under namespace nfdi4chem with dev-latest tag
# - Prevent redundant builds using concurrency control
#
# Maintainers:
# - name: Nisha Sharma
# - email: nisha.sharma@uni-jena.de
name : Prod Build and Publish to Dev
on:
push:
branches: [development]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NMRKIT_REPOSITORY_NAME: nmrkit
NMR_CLI_REPOSITORY_NAME: nmr-cli
REPOSITORY_NAMESPACE: nfdi4chem
RELEASE_TAG: dev-latest
jobs:
# test_and_lint:
# uses: NFDI4Chem/nmrkit/.github/workflows/test.yml@main
build_and_push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: test_and_lint
steps:
# Clone repository code to runner
- name: Check out the repo
uses: actions/checkout@v4
# Enable advanced Docker build features (required for caching)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Authenticate with Docker Hub for image push access
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Detect changes in nmr-cli folder to skip unnecessary builds
- name: Check for file changes
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
nmr-cli:
- 'app/scripts/nmr-cli/**'
# Build main nmrKit image with registry caching for faster builds
- name: Build and push nmrKit Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
build-args: RELEASE_VERSION=${{ env.RELEASE_TAG }}
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }}
cache-from: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:buildcache,mode=max
# Build nmr-cli image only if files in app/scripts/nmr-cli/ changed
- name: Build and push nmr-cli Docker image
if: steps.changes.outputs.nmr-cli == 'true'
uses: docker/build-push-action@v6
with:
context: ./app/scripts/nmr-cli/
file: ./app/scripts/nmr-cli/Dockerfile
push: true
build-args: RELEASE_VERSION=${{ env.RELEASE_TAG }}
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }}
cache-from: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:buildcache,mode=max