Skip to content

Commit ec2d123

Browse files
authored
feat(entropy-tester): add docker image workflow (#2772)
* feat(entropy-tester): add docker image workflow
1 parent 87e43ca commit ec2d123

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Push Entropy Tester Image
2+
on:
3+
push:
4+
tags:
5+
- entropy-tester-v*
6+
pull_request:
7+
paths:
8+
- "apps/entropy-tester/**"
9+
- ".github/workflows/docker-entropy-tester.yml"
10+
- "Dockerfile.node"
11+
workflow_dispatch:
12+
inputs:
13+
dispatch_description:
14+
description: "Dispatch description"
15+
required: true
16+
type: string
17+
permissions:
18+
contents: read
19+
id-token: write
20+
packages: write
21+
env:
22+
REGISTRY: ghcr.io
23+
IMAGE_NAME: pyth-network/entropy-tester
24+
jobs:
25+
entropy-tester-image:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Set image tag to version of the git tag
30+
if: ${{ startsWith(github.ref, 'refs/tags/entropy-tester-v') }}
31+
run: |
32+
PREFIX="refs/tags/entropy-tester-"
33+
VERSION="${GITHUB_REF:${#PREFIX}}"
34+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
35+
- name: Set image tag to the git commit hash
36+
if: ${{ !startsWith(github.ref, 'refs/tags/entropy-tester-v') }}
37+
run: |
38+
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
39+
- name: Log in to the Container registry
40+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
41+
with:
42+
registry: ${{ env.REGISTRY }}
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Build docker image
46+
run: |
47+
DOCKER_BUILDKIT=1 docker build --build-arg package="@pythnetwork/entropy-tester" -t ${{ env.REGISTRY }}/pyth-network/entropy-tester:${{ env.IMAGE_TAG }} -f Dockerfile.node .
48+
- name: Push docker image
49+
run: |
50+
docker push ${{ env.REGISTRY }}/pyth-network/entropy-tester:${{ env.IMAGE_TAG }}

0 commit comments

Comments
 (0)