-
Notifications
You must be signed in to change notification settings - Fork 14
61 lines (48 loc) · 1.84 KB
/
docker.yml
File metadata and controls
61 lines (48 loc) · 1.84 KB
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
name: Build and Push Docker Image
on:
push:
branches: [ main, dev ] # or your deployment branch
workflow_dispatch: # allow manual trigger
env:
IMAGE_REPO: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # needed for GitHub Container Registry
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Ziren toolchain
run: curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ProjectZKM/toolchain/refs/heads/main/setup.sh | sh
- name: Extract version from Cargo.toml
id: version
run: |
VERSION=$(grep '^version =' Cargo.toml | head -n1 | sed -E 's/version = "(.*)"/\1/')
echo "CARGO_VERSION=$VERSION" >> $GITHUB_ENV
echo "Using version: $VERSION"
- name: Install Dependencies
run: sudo apt-get update && sudo apt install protobuf-compiler -y
- name: Build all binaries
run: source ~/.zkm-toolchain/env && cargo build -r --workspace
- name: Set lowercase repo name
id: lowercase
run: echo "REPO_LOWER=$(echo '${{ env.IMAGE_REPO }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry (ghcr.io)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./
file: ./node/Dockerfile
push: true
tags: |
ghcr.io/${{ env.REPO_LOWER }}-node:latest
ghcr.io/${{ env.REPO_LOWER }}-node:${{ env.CARGO_VERSION }}