12
12
GO_VER : 1.23.1
13
13
UBUNTU_VER : 20.04
14
14
FABRIC_VER : ${{ github.ref_name }}
15
- DOCKER_REGISTRY : ${{ github.repository_owner == 'hyperledger' && 'docker.io' || 'ghcr.io' }}
16
15
17
16
permissions :
18
17
contents : read
@@ -23,21 +22,21 @@ jobs:
23
22
strategy :
24
23
matrix :
25
24
include :
26
- - image : ubuntu-20.04
27
- target : linux
28
- arch : amd64
29
- - image : ubuntu-20.04
30
- target : linux
31
- arch : arm64
32
- - image : macos-11
33
- target : darwin
34
- arch : amd64
35
- - image : macos-11
36
- target : darwin
37
- arch : arm64
38
- - image : windows-2022
39
- target : windows
40
- arch : amd64
25
+ - image : ubuntu-20.04
26
+ target : linux
27
+ arch : amd64
28
+ - image : ubuntu-20.04
29
+ target : linux
30
+ arch : arm64
31
+ - image : macos-11
32
+ target : darwin
33
+ arch : amd64
34
+ - image : macos-11
35
+ target : darwin
36
+ arch : arm64
37
+ - image : windows-2022
38
+ target : windows
39
+ arch : amd64
41
40
runs-on : ubuntu-20.04
42
41
steps :
43
42
- name : Checkout Fabric Code
@@ -69,57 +68,65 @@ jobs:
69
68
packages : write
70
69
71
70
strategy :
71
+ fail-fast : false
72
72
matrix :
73
- include :
74
- - COMPONENT : baseos
75
- CONTEXT : images/baseos
76
- - COMPONENT : ccenv
77
- CONTEXT : images/ccenv
78
- - COMPONENT : peer
79
- CONTEXT : .
80
- - COMPONENT : orderer
81
- CONTEXT : .
82
- - COMPONENT : tools
83
- CONTEXT : .
73
+ registry :
74
+ - docker.io
75
+ - ghcr.io
76
+ component :
77
+ - name : baseos
78
+ context : images/baseos
79
+ - name : ccenv
80
+ context : images/ccenv
81
+ - name : peer
82
+ context : .
83
+ - name : orderer
84
+ context : .
85
+ - name : tools
86
+ context : .
84
87
85
88
steps :
89
+ - name : Skip Docker Hub publish for forks
90
+ if : ${{ github.repository_owner != 'hyperledger' && matrix.registry == 'docker.io' }}
91
+ run : exit 1
92
+
86
93
- name : Set up QEMU
87
94
uses : docker/setup-qemu-action@v3
88
95
89
96
- name : Set up Docker Buildx
90
97
uses : docker/setup-buildx-action@v3
91
98
with :
92
99
buildkitd-flags : --debug
93
- config-inline : |
100
+ buildkitd- config-inline : |
94
101
[worker.oci]
95
102
max-parallelism = 1
96
103
97
104
- name : Checkout
98
105
uses : actions/checkout@v4
99
106
100
- - name : Login to the ${{ env.DOCKER_REGISTRY }} Container Registry
107
+ - name : Login to the ${{ matrix.registry }} Container Registry
101
108
uses : docker/login-action@v3
102
109
with :
103
- registry : ${{ env.DOCKER_REGISTRY }}
104
- username : ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }}
105
- password : ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }}
110
+ registry : ${{ matrix.registry }}
111
+ username : ${{ matrix.registry == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }}
112
+ password : ${{ matrix.registry == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }}
106
113
107
114
- name : Docker meta
108
115
id : meta
109
116
uses : docker/metadata-action@v5
110
117
with :
111
- images : ${{ env.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-${{ matrix.COMPONENT }}
118
+ images : ${{ matrix.registry }}/${{ github.repository_owner }}/fabric-${{ matrix.component.name }}
112
119
tags : |
113
120
type=semver,pattern={{version}}
114
121
type=semver,pattern={{major}}.{{minor}}
115
122
type=semver,pattern={{major}}.{{minor}}.{{patch}}
116
123
117
- - name : Build and push ${{ matrix.COMPONENT }} Image
124
+ - name : Build and push ${{ matrix.component.name }} Image
118
125
id : push
119
126
uses : docker/build-push-action@v5
120
127
with :
121
- context : ${{ matrix.CONTEXT }}
122
- file : images/${{ matrix.COMPONENT }}/Dockerfile
128
+ context : ${{ matrix.component.context }}
129
+ file : images/${{ matrix.component.name }}/Dockerfile
123
130
platforms : linux/amd64,linux/arm64
124
131
tags : ${{ steps.meta.outputs.tags }}
125
132
push : ${{ github.event_name != 'pull_request' }}
0 commit comments