Skip to content

Commit d491e84

Browse files
committed
Split out the CI test that pushes new container to Dockerhub, only run this on pushes to main
1 parent 47752e1 commit d491e84

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: build_test_and_push_docker
2+
3+
on:
4+
push:
5+
branches:
6+
# Only build containers when pushing to main
7+
- "main"
8+
9+
env:
10+
LATEST_TAG: NCAR/ccpp-scm:latest
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
- name: Login to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
- name: Push latest tag
28+
uses: docker/build-push-action@v5
29+
with:
30+
context: .
31+
file: docker/Dockerfile
32+
platforms: linux/amd64,linux/arm64
33+
push: true
34+
tags: ${{ env.LATEST_TAG }}

.github/workflows/ci_test_docker.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
name: build_test_and_push_docker
22

3-
on:
4-
push:
5-
# branches:
6-
# - "main"
3+
on: [pull_request,workflow_dispatch]
74

85
env:
9-
TEST_TAG: mkavulich/ccpp-scm:test
10-
LATEST_TAG: mkavulich/ccpp-scm:latest
6+
TEST_TAG: NCAR/ccpp-scm:test
117

128
jobs:
139
docker:
@@ -33,15 +29,6 @@ jobs:
3329
tags: ${{ env.TEST_TAG }}
3430
- name: Test
3531
run: |
36-
docker pull ${{ env.TEST_TAG }}
3732
mkdir $HOME/output
3833
chmod a+rw $HOME/output
3934
docker run --rm -v $HOME/output:/home ${{ env.TEST_TAG }} ./run_scm.py -f ../../test/rt_test_cases.py --runtime_mult 0.1 -d
40-
- name: Push latest tag
41-
uses: docker/build-push-action@v5
42-
with:
43-
context: .
44-
file: docker/Dockerfile
45-
platforms: linux/amd64,linux/arm64
46-
push: true
47-
tags: ${{ env.LATEST_TAG }}

0 commit comments

Comments
 (0)