-
Notifications
You must be signed in to change notification settings - Fork 197
69 lines (59 loc) · 1.88 KB
/
docker-localnet.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
name: Publish Localnet Docker Image
on:
release:
types: [published]
workflow_dispatch:
inputs:
branch-or-tag:
description: "Branch or tag to use for the Docker image tag and ref to checkout (optional)"
required: false
default: ""
push:
branches:
- devnet-ready
permissions:
contents: read
packages: write
actions: read
security-events: write
jobs:
publish:
runs-on: SubtensorCI
steps:
- name: Determine Docker tag and ref
id: tag
run: |
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
echo "Determined branch or tag: $branch_or_tag"
echo "tag=$branch_or_tag" >> $GITHUB_ENV
echo "ref=$branch_or_tag" >> $GITHUB_ENV
# Check if this is a tagged release (not devnet-ready/devnet/testnet)
if [[ "$branch_or_tag" != "devnet-ready" ]]; then
echo "latest_tag=true" >> $GITHUB_ENV
else
echo "latest_tag=false" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile-localnet
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}-localnet:${{ env.tag }}
${{ env.latest_tag == 'true' && format('ghcr.io/{0}-localnet:latest', github.repository) || '' }}