From d63e99e49d16d22ce363d6f2ddf460036ae6ba9a Mon Sep 17 00:00:00 2001 From: Nisha Sharma Date: Tue, 28 Jul 2026 12:06:07 +0200 Subject: [PATCH 1/2] build: update prod build workflow to build image with release tag --- .github/workflows/prod-build.yml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 62fb832..13e6a34 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -1,8 +1,8 @@ # This workflow will perform following actions when code is pushed to the main 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 +# - Build and push nmrKit Docker image with latest and release-version tags # - Conditionally build nmr-cli image only if files in app/scripts/nmr-cli/ changed -# - Push images to Docker Hub under namespace nfdi4chem with latest tag +# - Push images to Docker Hub under namespace nfdi4chem with latest tags (plus release-version tags) # - Prevent redundant builds using concurrency control # # Maintainers: @@ -93,6 +93,19 @@ jobs: nmr-cli: - 'app/scripts/nmr-cli/**' + # Read release version from app config for versioned Docker tags + - name: Read project release version + id: release_version + shell: bash + run: | + PROJECT_VERSION=$(sed -nE 's/^VERSION\s*=\s*"([^"]+)"/\1/p' app/core/config.py | head -n1) + if [[ -z "$PROJECT_VERSION" ]]; then + echo "Unable to read VERSION from app/core/config.py" + exit 1 + fi + echo "project_version=$PROJECT_VERSION" >> "$GITHUB_OUTPUT" + echo "Detected release version: $PROJECT_VERSION" + # Build main nmrKit image with registry caching for faster builds - name: Build and push nmrKit Docker image uses: docker/build-push-action@v6 @@ -100,8 +113,10 @@ jobs: context: . file: ./Dockerfile push: true - build-args: RELEASE_VERSION=${{ env.RELEASE_TAG }} - tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }} + build-args: RELEASE_VERSION=${{ steps.release_version.outputs.project_version }} + tags: | + ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }} + ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ steps.release_version.outputs.project_version }} 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 @@ -113,7 +128,9 @@ jobs: 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 }} + build-args: RELEASE_VERSION=${{ steps.release_version.outputs.project_version }} + tags: | + ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }} + ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ steps.release_version.outputs.project_version }} 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 From 8b9442656eca1dca1ca6c357a0e48f0044b92125 Mon Sep 17 00:00:00 2001 From: Nisha Sharma Date: Thu, 13 Aug 2026 12:49:17 +0200 Subject: [PATCH 2/2] build: update prod build workflow to create and push docker image with release tag --- .github/workflows/prod-build.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 13e6a34..13c6ed8 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -93,18 +93,13 @@ jobs: nmr-cli: - 'app/scripts/nmr-cli/**' - # Read release version from app config for versioned Docker tags - - name: Read project release version + # Fetch the latest GitHub release tag for versioned Docker tags + - name: Get latest release version id: release_version - shell: bash - run: | - PROJECT_VERSION=$(sed -nE 's/^VERSION\s*=\s*"([^"]+)"/\1/p' app/core/config.py | head -n1) - if [[ -z "$PROJECT_VERSION" ]]; then - echo "Unable to read VERSION from app/core/config.py" - exit 1 - fi - echo "project_version=$PROJECT_VERSION" >> "$GITHUB_OUTPUT" - echo "Detected release version: $PROJECT_VERSION" + uses: pozetroninc/github-action-get-latest-release@v0.8.0 + with: + repository: ${{ github.repository }} + token: ${{ secrets.GITHUB_TOKEN }} # Build main nmrKit image with registry caching for faster builds - name: Build and push nmrKit Docker image @@ -113,10 +108,10 @@ jobs: context: . file: ./Dockerfile push: true - build-args: RELEASE_VERSION=${{ steps.release_version.outputs.project_version }} + build-args: RELEASE_VERSION=${{ steps.release_version.outputs.release }} tags: | ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }} - ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ steps.release_version.outputs.project_version }} + ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMRKIT_REPOSITORY_NAME }}:${{ steps.release_version.outputs.release }} 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 @@ -128,9 +123,9 @@ jobs: context: ./app/scripts/nmr-cli/ file: ./app/scripts/nmr-cli/Dockerfile push: true - build-args: RELEASE_VERSION=${{ steps.release_version.outputs.project_version }} + build-args: RELEASE_VERSION=${{ steps.release_version.outputs.release }} tags: | ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ env.RELEASE_TAG }} - ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ steps.release_version.outputs.project_version }} + ${{ env.REPOSITORY_NAMESPACE }}/${{ env.NMR_CLI_REPOSITORY_NAME }}:${{ steps.release_version.outputs.release }} 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