|
8 | 8 | - 'docker/parent-base/**'
|
9 | 9 | pull_request:
|
10 | 10 | branches: [ "master" ]
|
| 11 | + types: |
| 12 | + - closed |
| 13 | + - opened |
11 | 14 | paths:
|
12 | 15 | - 'docker/enclave-base/**'
|
13 | 16 | - 'docker/parent-base/**'
|
14 | 17 |
|
15 | 18 | jobs:
|
16 |
| - build-and-publish: |
| 19 | + build-docker-images: |
17 | 20 | runs-on: ubuntu-20.04
|
| 21 | + if: github.event_name == 'pull_request' && github.event.action == 'opened' |
18 | 22 | steps:
|
19 | 23 | - name: Pull main repository
|
20 | 24 | uses: actions/checkout@v3
|
21 | 25 | with:
|
22 | 26 | repository: fortanix/salmiac
|
23 | 27 |
|
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 |
| - |
30 | 28 | - name: Build docker images
|
31 | 29 | run: |
|
32 | 30 | cd docker/enclave-base
|
33 | 31 | docker build -t fortanix/enclave-base .
|
| 32 | + docker save -o /tmp/enclave-base.tar fortanix/enclave-base |
34 | 33 |
|
35 | 34 | cd ../parent-base
|
36 | 35 | 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 }} |
37 | 78 |
|
38 | 79 | - name: Push docker images
|
39 | 80 | run: |
|
|
0 commit comments