Skip to content

Commit d9a73f0

Browse files
committed
Add a GHA WF for release image publishing, a single WF for both integration and production docker image publishing
Signed-off-by: Alfredo Gutierrez <[email protected]>
1 parent e39f64d commit d9a73f0

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release Workflow
2+
3+
on:
4+
push:
5+
# `v*` tags are used for production environment
6+
tags: [ v* ]
7+
# `main` tag is used for integration environment
8+
branches: [ main ]
9+
# Manual trigger with custom release tag
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Release tag:'
14+
type: string
15+
required: false
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
permissions:
22+
contents: read
23+
packages: write
24+
25+
env:
26+
OWNER: hashgraph
27+
PACKAGE_NAME: hedera-block-node
28+
REGISTRY: ghcr.io
29+
30+
jobs:
31+
publish:
32+
runs-on: [self-hosted, Linux, medium, ephemeral]
33+
34+
steps:
35+
- name: Harden Runner
36+
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
37+
with:
38+
egress-policy: audit
39+
40+
- name: Checkout repository
41+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
42+
43+
- name: Get tag
44+
run: |
45+
if [[ "${{ github.event.inputs.version }}" ]]; then
46+
echo "TAG=${{ github.event.inputs.version }}" >> $GITHUB_ENV
47+
elif [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
48+
echo "TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
49+
else
50+
echo "TAG=main" >> $GITHUB_ENV
51+
fi
52+
53+
- name: Install JDK
54+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
55+
with:
56+
distribution: "temurin"
57+
java-version: 21
58+
59+
- name: Setup Gradle
60+
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3.5.0
61+
62+
- name: Build
63+
run: ./gradlew clean build
64+
65+
- name: Login to GitHub Container Registry
66+
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
67+
with:
68+
registry: ${{ env.REGISTRY }}
69+
username: ${{ github.actor }}
70+
password: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Set up Docker Qemu
73+
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
74+
75+
- name: Set up Docker Buildx
76+
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
77+
with:
78+
driver-opts: network=host
79+
80+
- name: Build and push image
81+
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12 # v6.4.1
82+
with:
83+
context: ./server/docker
84+
file: ./server/docker/Dockerfile
85+
cache-from: type=gha
86+
cache-to: type=gha,mode=max
87+
platforms: linux/amd64, linux/arm64
88+
push: true
89+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}

0 commit comments

Comments
 (0)