-
Notifications
You must be signed in to change notification settings - Fork 207
111 lines (106 loc) · 3.71 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
# 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 }}