forked from hyperledger/fabric-ca
-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (119 loc) · 4.03 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
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
push:
tags: [ v1.* ]
env:
GO_VER: 1.18.9
UBUNTU_VER: 20.04
DOCKER_REGISTRY: ${{ github.repository_owner == 'hyperledger' && 'docker.io' || 'ghcr.io' }}
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
jobs:
build-binaries:
name: Build Fabric CA Binaries
strategy:
matrix:
include:
- image: ubuntu-20.04
platform: linux-amd64
- image: ubuntu-20.04
platform: linux-arm64
- image: macos-12
platform: darwin-arm64
- image: macos-12
platform: darwin-amd64
- image: windows-2022
platform: windows-amd64
runs-on: ${{ matrix.image }}
steps:
- uses: actions/setup-go@v3
name: Install Go
with:
go-version: ${{ env.GO_VER }}
- uses: actions/checkout@v3
name: Checkout Fabric CA Code
- name: Install GCC cross-compilers
if: ${{ contains(matrix.platform, 'linux') }}
run: |
sudo apt-get update
sudo apt-get -y install gcc-aarch64-linux-gnu
sudo apt-get -y install gcc-x86-64-linux-gnu
- run: make dist/${{ matrix.platform }}
name: Compile Binary and Create Tarball
env:
BASE_VERSION: ${{ github.ref_name }}
- uses: actions/upload-artifact@v3
name: Publish Release Artifacts
with:
# <name> of the artifact must not collide between platform/arch builds
name: release-${{ matrix.platform }}
# <path> of the artifact may include multiple files.
path: release/${{ matrix.platform }}/*.tar.gz
build-and-push-image:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to the ${{ env.DOCKER_REGISTRY }} Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
id: push
uses: docker/build-push-action@v3
with:
context: .
file: images/fabric-ca/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
UBUNTU_VER=${{ env.UBUNTU_VER }}
GO_VER=${{ env.GO_VER }}
GO_TAGS=pkcs11
GO_LDFLAGS=-X github.com/hyperledger/fabric-ca/lib/metadata.Version=${{ github.ref_name }}
create-release:
name: Create GitHub Release
needs:
- build-binaries
- build-and-push-image
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout Fabric CA Code
uses: actions/checkout@v3
- name: Download Artifacts
id: download
uses: actions/download-artifact@v3
- name: Release Fabric CA Version
uses: ncipollo/release-action@v1
with:
allowUpdates: "true"
artifacts: "release-*-*/*.tar.gz"
bodyFile: release_notes/${{ github.ref_name }}.md
tag: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}