Merge pull request #10 from ImperialCollegeLondon/BloccProtocol #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
branches: | |
- BloccProtocol-release | |
env: | |
GO_VER: 1.20.4 | |
UBUNTU_VER: 20.04 | |
FABRIC_VER: v2.5.1 | |
REGISTRY: ghcr.io | |
permissions: | |
contents: read | |
jobs: | |
build-binaries: | |
name: Build Fabric Binaries | |
strategy: | |
matrix: | |
include: | |
- image: ubuntu-20.04 | |
target: linux | |
arch: amd64 | |
- image: ubuntu-20.04 | |
target: linux | |
arch: arm64 | |
- image: macos-11 | |
target: darwin | |
arch: amd64 | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VER }} | |
- name: Checkout Fabric Code | |
uses: actions/checkout@v3 | |
- 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@v3 | |
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: ubuntu-20.04 | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
include: | |
- COMPONENT: baseos | |
CONTEXT: images/baseos | |
- COMPONENT: ccenv | |
CONTEXT: images/ccenv | |
- COMPONENT: peer | |
CONTEXT: . | |
- COMPONENT: orderer | |
CONTEXT: . | |
- COMPONENT: tools | |
CONTEXT: . | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
config-inline: | | |
[worker.oci] | |
max-parallelism = 1 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Log in to GitHub Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/fabric-${{ matrix.COMPONENT }} | |
- name: Build and push ${{ matrix.COMPONENT }} Image | |
id: push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ matrix.CONTEXT }} | |
file: images/${{ matrix.COMPONENT }}/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true | |
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: ubuntu-20.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Fabric Code | |
uses: actions/checkout@v3 | |
- name: Download Artifacts | |
id: download | |
uses: actions/download-artifact@v3 | |
- name: Release Fabric Version | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: "true" | |
artifacts: "release-*-*/*.tar.gz" | |
tag: latest | |
name: BLOCC Fabric Binaries |