Skip to content

Bump actions/download-artifact to v4 (#4870) #36

Bump actions/download-artifact to v4 (#4870)

Bump actions/download-artifact to v4 (#4870) #36

Workflow file for this run

# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
push:
tags: [ v2.* ]
env:
GO_VER: 1.22.3
UBUNTU_VER: 20.04
FABRIC_VER: ${{ github.ref_name }}
DOCKER_REGISTRY: ${{ github.repository_owner == 'hyperledger' && 'docker.io' || '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
- image: macos-11
target: darwin
arch: arm64
- image: windows-2022
target: windows
arch: amd64
runs-on: ubuntu-20.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: 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@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Checkout
uses: actions/checkout@v4
- name: Login to the ${{ env.DOCKER_REGISTRY }} Container Registry
uses: docker/login-action@v3
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@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-${{ matrix.COMPONENT }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push ${{ matrix.COMPONENT }} Image
id: push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.CONTEXT }}
file: images/${{ matrix.COMPONENT }}/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: ubuntu-20.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 }}