Skip to content

Commit bc4368f

Browse files
authored
Release image publish (#48)
Signed-off-by: Alfredo Gutierrez <[email protected]>
1 parent e39f64d commit bc4368f

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
##
2+
# Copyright (C) 2024 Hedera Hashgraph, LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
##
16+
name: Release Workflow
17+
18+
on:
19+
push:
20+
# `v*` tags are used for production environment
21+
tags: [ v* ]
22+
# `main` tag is used for integration environment
23+
branches: [ main ]
24+
# Manual trigger with custom release tag
25+
workflow_dispatch:
26+
inputs:
27+
version:
28+
description: 'Release tag:'
29+
type: string
30+
required: false
31+
32+
defaults:
33+
run:
34+
shell: bash
35+
36+
permissions:
37+
contents: read
38+
packages: write
39+
40+
env:
41+
OWNER: hashgraph
42+
PACKAGE_NAME: hedera-block-node
43+
REGISTRY: ghcr.io
44+
45+
jobs:
46+
publish:
47+
runs-on: [self-hosted, Linux, medium, ephemeral]
48+
49+
steps:
50+
- name: Harden Runner
51+
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
52+
with:
53+
egress-policy: audit
54+
55+
- name: Checkout repository
56+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
57+
58+
- name: Get tag
59+
run: |
60+
if [[ "${{ github.event.inputs.version }}" ]]; then
61+
echo "TAG=${{ github.event.inputs.version }}" >> $GITHUB_ENV
62+
elif [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
63+
echo "TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
64+
else
65+
echo "TAG=main" >> $GITHUB_ENV
66+
fi
67+
68+
- name: Install JDK
69+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
70+
with:
71+
distribution: "temurin"
72+
java-version: 21
73+
74+
- name: Build
75+
run: ./gradlew clean build
76+
77+
- name: Login to GitHub Container Registry
78+
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
79+
with:
80+
registry: ${{ env.REGISTRY }}
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Set up Docker Qemu
85+
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
86+
87+
- name: Set up Docker Buildx
88+
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
89+
with:
90+
driver-opts: network=host
91+
92+
- name: Build and push image
93+
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12 # v6.4.1
94+
with:
95+
context: ./server/docker
96+
file: ./server/docker/Dockerfile
97+
cache-from: type=gha
98+
cache-to: type=gha,mode=max
99+
platforms: linux/amd64, linux/arm64
100+
push: true
101+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}

0 commit comments

Comments
 (0)