-
Notifications
You must be signed in to change notification settings - Fork 161
73 lines (63 loc) · 2.09 KB
/
push-docker-tagged.yaml
File metadata and controls
73 lines (63 loc) · 2.09 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
62
63
64
65
66
67
68
69
70
71
72
73
name: Build & push Docker image (GHCR)
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*' # run on semver tags
workflow_dispatch:
inputs:
tag:
description: 'Image tag to publish (e.g., v1.2.3 or test-123). If empty, uses the pushed tag or falls back to short SHA.'
required: false
type: string
permissions:
contents: read
packages: write
jobs:
build-docker:
runs-on: [self-hosted, linux, X64, hc]
outputs:
sha_short: ${{ steps.setvars.outputs.sha_short }}
tag: ${{ steps.setvars.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true # replaces manual init/update steps
- name: Set vars (tag & sha)
id: setvars
shell: bash
run: |
# Prefer manual input; then pushed tag; else short SHA
TAG_INPUT="${{ inputs.tag }}"
if [ -n "$TAG_INPUT" ]; then
TAG="$TAG_INPUT"
elif [ "${{ github.ref_type }}" = "tag" ] && [ -n "${{ github.ref_name }}" ]; then
TAG="${{ github.ref_name }}"
else
TAG="manual-${GITHUB_SHA::7}"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "sha_short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- 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 (executor)
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile-GHA
platforms: linux/amd64
target: executor
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/zkevm-prover:${{ steps.setvars.outputs.tag }}
labels: |
org.opencontainers.image.source=${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}