Skip to content

Commit 5b23297

Browse files
committed
ci: testing new flows with layers caching & upgraded build graph
1 parent 6d145f0 commit 5b23297

File tree

3 files changed

+47
-7
lines changed

3 files changed

+47
-7
lines changed

.github/workflows/docker-publish.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
name: Build and Publish Docker image to GHCR
22

33
on:
4-
push:
5-
tags: ["v*.*.*"]
64
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version string to tag Docker image with when manually dispatched (e.g., 0.9.2)"
8+
required: false
9+
default: "0.0.0-dev"
10+
workflow_call:
11+
inputs:
12+
version:
13+
description: "Version string to tag Docker image with when called from another workflow"
14+
type: string
15+
required: false
16+
default: "0.0.0-dev"
717

818
jobs:
919
build-and-push:
@@ -30,6 +40,17 @@ jobs:
3040
id: repo_owner
3141
run: echo "lowercase=$(echo ${GITHUB_REPOSITORY_OWNER} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
3242

43+
# Determine release version for tagging
44+
- name: Extract release version
45+
id: vars
46+
run: |
47+
TAG="${GITHUB_REF#refs/tags/v}"
48+
if [[ "$TAG" != "$GITHUB_REF" && "$TAG" != "" ]]; then
49+
echo "version=$TAG" >> "$GITHUB_OUTPUT"
50+
else
51+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
52+
fi
53+
3354
# Log in to GitHub Container Registry using the auto-generated token
3455
- name: Log in to GHCR
3556
uses: docker/login-action@v3
@@ -44,16 +65,22 @@ jobs:
4465
uses: docker/metadata-action@v5
4566
with:
4667
images: ghcr.io/${{ steps.repo_owner.outputs.lowercase }}/wireport
68+
tags: |
69+
type=semver,pattern={{version}},value=${{ steps.vars.outputs.version }}
70+
type=semver,pattern={{major}}.{{minor}},value=${{ steps.vars.outputs.version }}
71+
type=semver,pattern={{major}},value=${{ steps.vars.outputs.version }}
4772
4873
# Build and push the image defined in wireport/Dockerfile
49-
- name: Build and push Docker image
74+
- name: Build & push (inline cache)
5075
uses: docker/build-push-action@v5
5176
with:
52-
context: ./
77+
context: .
5378
file: ./Dockerfile
5479
push: true
5580
platforms: linux/amd64,linux/arm64
5681
tags: ${{ steps.meta.outputs.tags }}
5782
labels: ${{ steps.meta.outputs.labels }}
5883
cache-from: type=registry,ref=ghcr.io/${{ steps.repo_owner.outputs.lowercase }}/wireport:buildcache
59-
cache-to: type=registry,ref=ghcr.io/${{ steps.repo_owner.outputs.lowercase }}/wireport:buildcache,mode=max
84+
cache-to: type=registry,ref=ghcr.io/${{ steps.repo_owner.outputs.lowercase }}/wireport:buildcache,mode=max
85+
build-args: |
86+
BUILDKIT_INLINE_CACHE=1

.github/workflows/release-packages.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ on:
1515
default: "false"
1616

1717
jobs:
18+
#-------------------------------------------------------------------
19+
# Job: docker-publish
20+
# • Builds and pushes Docker image via reusable workflow
21+
#-------------------------------------------------------------------
22+
docker-publish:
23+
name: Build & Publish Docker image
24+
uses: ./.github/workflows/docker-publish.yml
25+
with:
26+
version: ${{ inputs.version }}
27+
secrets: inherit
28+
1829
#-------------------------------------------------------------------
1930
# Job: linux-build
2031
# • Runs on Ubuntu
@@ -124,7 +135,7 @@ jobs:
124135
publish:
125136
name: Publish GitHub Release
126137
runs-on: ubuntu-latest
127-
needs: [linux-build, macos-build]
138+
needs: [linux-build, macos-build, docker-publish]
128139
if: github.event_name == 'push' || inputs.publish_release == 'true'
129140

130141
permissions:

app/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
VERSION ?= 0.9.1
1+
VERSION ?= $(shell \
2+
tag=$$(git describe --abbrev=0 --tags 2>/dev/null || echo v0.0.0); \
3+
echo $${tag}-dev)
24
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
35
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
46
OUT_PATH ?= dist

0 commit comments

Comments
 (0)