forked from NOAA-GFDL/fre-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 1.59 KB
/
Copy pathupdate_container_image.yaml
File metadata and controls
61 lines (53 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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]
env:
REGISTRY: ghcr.io
IMAGE_NAME: "noaa-gfdl/ubuntu-20-fre-cli-2025"
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine image 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"
- name: Log in to the Container registry
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' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./container-files/Dockerfile-fre-cli
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.set_tag.outputs.docker_tag }}