Skip to content

Commit e386b0b

Browse files
authored
Merge pull request #16 from NOAA-GFDL/auto-update-ppp
file ending
2 parents c9f2972 + 03dadc1 commit e386b0b

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Docker Image CI/CD
2+
3+
# Trigger the workflow
4+
on:
5+
push:
6+
branches:
7+
- main # Trigger on push to the main branch
8+
# Build container if these files are changed
9+
paths:
10+
- 'Dockerfile-ppp'
11+
- 'ppp/runscript.sh'
12+
- '.github/workflows/update_ppp_image.yaml' # Or if the workflow file itself is change
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ NOAA-GFDL/HPC-ME/ppp }}
17+
18+
# Define the jobs to run
19+
jobs:
20+
build-and-push:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read # Allow checkout
24+
packages: write # Allow pushing to GitHub Packages/GHCR
25+
26+
steps:
27+
# Setup and Checkout
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
# Determine Tags
32+
- name: Extract metadata (tags) for Docker
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
tags: |
38+
type=sha,prefix=sha-,value=${{ github.sha }},enable=true,priority=1000
39+
type=raw,value=latest,enable=true
40+
type=raw,value=2025.04,enable=true #Adding fre-cli tag manually for now
41+
42+
# Login to GHCR
43+
- name: Log in to the Container registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }
49+
50+
# Build and Push
51+
- name: Build and push Docker image
52+
uses: docker/build-push-action@v5
53+
with:
54+
context: . # Directory containing the Dockerfilei
55+
file: ./Dockerfile-ppp
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)