Skip to content

Commit ec0166c

Browse files
authored
Merge pull request #21 from NOAA-GFDL/RepoDispatch
new repo dispatch
2 parents db85001 + be0cc9c commit ec0166c

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed
Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,56 @@
11
name: Docker Image CI/CD
2-
3-
# Trigger the workflow
2+
43
on:
54
push:
65
branches:
7-
- main # Trigger on push to the main branch
6+
- main # Trigger on push to the main branch
87
# Build container if these files are changed
98
paths:
109
- 'Dockerfile-ppp'
1110
- 'ppp/runscript.sh'
1211
- 'ppp/cylc-flow-tools.yaml'
1312
- '.github/workflows/update_ppp_image.yaml'
13+
repository_dispatch:
14+
types: [fre-cli-release]
1415

1516
env:
1617
REGISTRY: ghcr.io
1718
IMAGE_NAME: "NOAA-GFDL/HPC-ME/ppp"
1819

19-
# Define the jobs to run
2020
jobs:
2121
build-and-push:
2222
runs-on: ubuntu-latest
2323
permissions:
24-
contents: read # Allow checkout
25-
packages: write # Allow pushing to GitHub Packages/GHCR
24+
contents: read # Allow checkout
25+
packages: write # Allow pushing to GitHub Packages/GHCR
2626

2727
steps:
28-
# Setup and Checkout
2928
- name: Checkout repository
3029
uses: actions/checkout@v4
31-
32-
# Determine Tags
33-
- name: Extract metadata (tags) for Docker
34-
id: meta
35-
uses: docker/metadata-action@v5
3630
with:
37-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38-
tags: |
39-
type=sha,prefix=sha-,value=${{ github.sha }},enable=true,priority=1000
40-
type=raw,value=latest,enable=true
41-
type=raw,value=2025.04,enable=true #Adding fre-cli tag manually for now
31+
fetch-depth: 0 # Ensure tags are available
32+
33+
- name: Set PPP Tag
34+
id: set_tag
35+
run: |
36+
if [ ! -z "${{ github.event.client_payload.tag }}" ]; then
37+
TAG="${{ github.event.client_payload.tag }}"
38+
else
39+
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "latest")
40+
fi
41+
echo "docker_tag=$TAG" >> $GITHUB_OUTPUT
4242
43-
# Login to GHCR
4443
- name: Log in to the Container registry
4544
uses: docker/login-action@v3
4645
with:
4746
registry: ${{ env.REGISTRY }}
4847
username: ${{ github.actor }}
4948
password: ${{ secrets.GITHUB_TOKEN }}
5049

51-
# Build and Push
5250
- name: Build and push Docker image
5351
uses: docker/build-push-action@v5
5452
with:
5553
context: . # Directory containing the Dockerfile
5654
file: ./Dockerfile-ppp
5755
push: true
58-
tags: ${{ steps.meta.outputs.tags }}
59-
labels: ${{ steps.meta.outputs.labels }}
56+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.set_tag.outputs.docker_tag }}

0 commit comments

Comments
 (0)