-
Notifications
You must be signed in to change notification settings - Fork 8.9k
162 lines (145 loc) · 4.94 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
workflow_dispatch: # workflow_dispatch must be enabled in main branch to support release action on older release branches
push:
tags:
- v2.*
- v3.*
env:
GO_VER: 1.23.4
UBUNTU_VER: 22.04
FABRIC_VER: ${{ github.ref_name }}
permissions:
contents: read
jobs:
build-binaries:
name: Build Fabric Binaries
strategy:
matrix:
include:
- image: fabric-ubuntu-22.04
target: linux
arch: amd64
- image: fabric-ubuntu-22.04
target: linux
arch: arm64
- image: macos-11
target: darwin
arch: amd64
- image: macos-11
target: darwin
arch: arm64
- image: fabric-windows-latest
target: windows
arch: amd64
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-22.04' || 'ubuntu-22.04' }}
steps:
- name: Checkout Fabric Code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VER }}
- name: Compile Binary and Create Tarball
run: ./ci/scripts/create_binary_package.sh
env:
TARGET: ${{ matrix.target }}-${{ matrix.arch }}
RELEASE: ${{ env.FABRIC_VER }}
- name: Publish Release Artifact
uses: actions/upload-artifact@v4
with:
# <name> of the artifact must not collide between platform/arch builds
name: release-${{ matrix.target }}-${{ matrix.arch }}
# <path> of the artifact may include multiple files.
path: release/${{ matrix.target }}-${{ matrix.arch }}/*.tar.gz
build-and-push-docker-images:
name: Build and Push
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-22.04' || 'ubuntu-22.04' }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
registry:
- docker.io
- ghcr.io
component:
- name: baseos
context: images/baseos
- name: ccenv
context: images/ccenv
- name: peer
context: .
- name: orderer
context: .
steps:
- name: Skip Docker Hub publish for forks
if: ${{ github.repository_owner != 'hyperledger' && matrix.registry == 'docker.io' }}
run: exit 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 1
- name: Checkout
uses: actions/checkout@v4
- name: Login to the ${{ matrix.registry }} Container Registry
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry }}
username: ${{ matrix.registry == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ matrix.registry == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.registry }}/${{ github.repository_owner }}/fabric-${{ matrix.component.name }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push ${{ matrix.component.name }} Image
id: push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.component.context }}
file: images/${{ matrix.component.name }}/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
FABRIC_VER=${{ env.FABRIC_VER }}
UBUNTU_VER=${{ env.UBUNTU_VER }}
GO_VER=${{ env.GO_VER }}
GO_TAGS=
create-release:
name: Create GitHub Release
needs:
- build-binaries
- build-and-push-docker-images
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-22.04' || 'ubuntu-22.04' }}
permissions:
contents: write
steps:
- name: Checkout Fabric Code
uses: actions/checkout@v4
- name: Download Artifacts
id: download
uses: actions/download-artifact@v4
- name: Release Fabric Version
uses: ncipollo/release-action@v1
with:
allowUpdates: "true"
artifacts: "release-*-*/*.tar.gz"
bodyFile: release_notes/${{ env.FABRIC_VER }}.md
tag: ${{ env.FABRIC_VER }}
token: ${{ secrets.GITHUB_TOKEN }}