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: | ||
create: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yaml | ||
Check failure on line 15 in .github/workflows/release.yml GitHub Actions / .github/workflows/release.ymlInvalid workflow file
|
||
# Publishing steps to both the Github Packages and the Sonatype | ||
publishjars: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
publish_target: | ||
- publishAllPublicationsToGithubPackagesRepository | ||
- publishAllPublicationsToReleaseRepository | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
cache: 'gradle' | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Push to registry ${{ matrix.publish_target }} | ||
run: | | ||
set -xev | ||
./gradlew -Psigning.key="${SIGNING_KEY}" -Psigning.password="${SIGNING_PASSWORD}" -PossrhUsername="${OSSRH_USER}" -PossrhPassword="${OSSRH_PASSWORD}" ${TARGET} | ||
env: | ||
SIGNING_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | ||
OSSRH_USER: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
TARGET: ${{ matrix.publish_target }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Publish to docker registries docker.io and ghcr.io | ||
publishdocker: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
DOCKER_REGISTRY: | ||
- 'docker.io' | ||
- 'ghcr.io' | ||
runs-on: ubuntu-latest | ||
needs: test | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
cache: 'gradle' | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Build the dependencies needed for the image | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: | | ||
:fabric-chaincode-docker:copyAllDeps | ||
- 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: Login to the ${{ matrix.DOCKER_REGISTRY }} Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ matrix.DOCKER_REGISTRY }} | ||
username: ${{ matrix.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }} | ||
password: ${{ matrix.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ matrix.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-javaenv | ||
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@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
file: fabric-chaincode-docker/Dockerfile | ||
context: fabric-chaincode-docker | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
labels: ${{ steps.meta.outputs.labels }} |