Skip to content

Commit 9ac6678

Browse files
author
Roman
committed
Add docker-localnet.yml workflow
1 parent b717c99 commit 9ac6678

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish Localnet Docker Image
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
branch-or-tag:
9+
description: "Branch or tag to use for the Docker image tag and ref to checkout (optional)"
10+
required: false
11+
default: ""
12+
push:
13+
branches:
14+
- devnet-ready
15+
- devnet
16+
- testnet
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
actions: read
22+
security-events: write
23+
24+
jobs:
25+
publish:
26+
runs-on: SubtensorCI
27+
28+
steps:
29+
- name: Determine Docker tag and ref
30+
id: tag
31+
run: |
32+
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
33+
echo "Determined branch or tag: $branch_or_tag"
34+
echo "tag=$branch_or_tag" >> $GITHUB_ENV
35+
echo "ref=$branch_or_tag" >> $GITHUB_ENV
36+
37+
# Check if this is a tagged release (not devnet-ready/devnet/testnet)
38+
if [[ "$branch_or_tag" != "devnet-ready" ]]; then
39+
echo "latest_tag=true" >> $GITHUB_ENV
40+
else
41+
echo "latest_tag=false" >> $GITHUB_ENV
42+
fi
43+
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
with:
47+
ref: ${{ env.ref }}
48+
49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@v2
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v2
54+
55+
- name: Login to GHCR
56+
uses: docker/login-action@v2
57+
with:
58+
registry: ghcr.io
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Build and push Docker image
63+
uses: docker/build-push-action@v4
64+
with:
65+
context: .
66+
file: Docker-localnet
67+
push: true
68+
platforms: linux/amd64,linux/arm64
69+
tags: |
70+
ghcr.io/${{ github.repository }}-localnet:${{ env.tag }}
71+
${{ env.latest_tag == 'true' && format('ghcr.io/{0}-localnet:latest', github.repository) || '' }}

0 commit comments

Comments
 (0)