Skip to content

Restore Java 8 compatibility (#349) #12

Restore Java 8 compatibility (#349)

Restore Java 8 compatibility (#349) #12

Workflow file for this run

# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
# 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
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/actions/wrapper-validation@v3
- uses: gradle/actions/setup-gradle@v3
- 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/actions/wrapper-validation@v3
- uses: gradle/actions/setup-gradle@v3
- name: Build the dependencies needed for the image
run: ./gradlew :fabric-chaincode-docker:copyAllDeps
- 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: Login to the ${{ matrix.DOCKER_REGISTRY }} Container Registry
uses: docker/login-action@v3
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@v5
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 image
id: push
uses: docker/build-push-action@v5
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 }}