Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 20 additions & 24 deletions .github/workflows/update_container_image.yaml
Comment thread
Ciheim marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ name: Build and Push Container Image

on:
workflow_dispatch:
inputs:
dry_run:
description: "Skip pushing container image"
required: true
default: "true"
type: choice
options: ["true", "false"]

repository_dispatch:
types: [publish-conda-succeeded]
workflow_run:
workflows: ["publish_conda"]
types: [completed]

env:
REGISTRY: ghcr.io
IMAGE_NAME: "noaa-gfdl/ubuntu-20-fre-cli-2025"
IMAGE_NAME: "noaa-gfdl/fre-cli"

jobs:
build-and-push:
Expand All @@ -30,32 +23,35 @@ jobs:
with:
fetch-depth: 0

- name: Determine image tag
- name: Fetch all tags
run: git fetch --tags

- name: Determine latest tag
id: set_tag
run: |
# Use the pushed tag if this is a tag ref; otherwise fall back.
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
TAG="latest"
else
TAG="${GITHUB_SHA::7}"
fi
echo "docker_tag=$TAG" >> "$GITHUB_OUTPUT"
echo "docker_tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"

- name: Show image tag
run: echo "Docker tag is ${{ steps.set_tag.outputs.docker_tag }}"

- name: Update fre-cli version in cylc-flow-tools.yaml
run: |
sed -i 's/^[[:space:]]*-[[:space:]]*noaa-gfdl::fre-cli==.*/ - noaa-gfdl::fre-cli==${{ steps.set_tag.outputs.docker_tag }}/' ./container-files/cylc-flow-tools.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cylc-flow-tools.yaml still contains this old tag

dependencies:
  - noaa-gfdl::fre-cli==2025.04

Why not commit the version change update to cylc-flow-tools.yaml?

Copy link
Copy Markdown
Contributor

@singhd789 singhd789 May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going off of this - the hsm package could also be tagged to 1.4.0 for that hsm update (though the container that is built won't work due to the lack of fregrid)


- name: Log in to the Container registry
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
if: ${{ inputs.dry_run != 'true' }}
- name: Build Docker image
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
uses: docker/build-push-action@v5
with:
context: .
file: ./container-files/Dockerfile-fre-cli
push: true
push: ${{ github.event_name == 'workflow_run' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.set_tag.outputs.docker_tag }}
Loading