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