Skip to content

Commit fc801bf

Browse files
committed
code review change
1 parent 7c3bb04 commit fc801bf

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

.github/workflows/build-docker-images.yml

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,73 @@ on:
88
- 'docker/parent-base/**'
99
pull_request:
1010
branches: [ "master" ]
11+
types:
12+
- closed
13+
- opened
1114
paths:
1215
- 'docker/enclave-base/**'
1316
- 'docker/parent-base/**'
1417

1518
jobs:
16-
build-and-publish:
19+
build-docker-images:
1720
runs-on: ubuntu-20.04
21+
if: github.event_name == 'pull_request' && github.event.action == 'opened'
1822
steps:
1923
- name: Pull main repository
2024
uses: actions/checkout@v3
2125
with:
2226
repository: fortanix/salmiac
2327

24-
- name: Login to Docker Hub
25-
uses: docker/login-action@v1
26-
with:
27-
username: ${{ secrets.DOCKER_USERNAME }}
28-
password: ${{ secrets.DOCKER_PASSWORD }}
29-
3028
- name: Build docker images
3129
run: |
3230
cd docker/enclave-base
3331
docker build -t fortanix/enclave-base .
32+
docker save -o /tmp/enclave-base.tar fortanix/enclave-base
3433
3534
cd ../parent-base
3635
docker build -t fortanix/parent-base .
36+
docker save -o /tmp/parent-base.tar fortanix/parent-base
37+
38+
- name: Upload enclave-base artifact
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: enclave-base
42+
path: /tmp/enclave-base.tar
43+
44+
- name: Upload parent-base artifact
45+
uses: actions/upload-artifact@v3
46+
with:
47+
name: parent-base
48+
path: /tmp/parent-base.tar
49+
50+
push-docker-images:
51+
runs-on: ubuntu-20.04
52+
needs: build-docker-images
53+
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
54+
steps:
55+
- name: Download enclave-base artifact
56+
uses: actions/download-artifact@v3
57+
with:
58+
name: enclave-base
59+
path: /tmp/enclave-base
60+
- name: Load enclave-base image
61+
run: |
62+
docker load --input /tmp/enclave-base/enclave-base.tar
63+
64+
- name: Download parent-base artifact
65+
uses: actions/download-artifact@v3
66+
with:
67+
name: parent-base
68+
path: /tmp/parent-base
69+
- name: Load parent-base image
70+
run: |
71+
docker load --input /tmp/parent-base/parent-base.tar
72+
73+
- name: Login to Docker Hub
74+
uses: docker/login-action@v1
75+
with:
76+
username: ${{ secrets.DOCKER_USERNAME }}
77+
password: ${{ secrets.DOCKER_PASSWORD }}
3778

3879
- name: Push docker images
3980
run: |

0 commit comments

Comments
 (0)