Skip to content

Commit 55c5689

Browse files
committed
feat: dockerhub release
1 parent e98b4d8 commit 55c5689

6 files changed

Lines changed: 108 additions & 3 deletions

File tree

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.git
2+
.gitignore
3+
target
4+
**/*.rs.bk

.github/workflows/docker.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: docker
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release tag (e.g. v1.2.3)"
11+
required: true
12+
type: string
13+
14+
jobs:
15+
linux:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
env:
20+
IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/diff-coverage
21+
ALPINE_VERSION: "3.20"
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set version
25+
run: |
26+
TAG="${{ inputs.tag }}"
27+
if [ -z "$TAG" ]; then TAG="$GITHUB_REF_NAME"; fi
28+
VERSION="${TAG#v}"
29+
echo "TAG=$TAG" >> "$GITHUB_ENV"
30+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
31+
- name: Wait for release binaries
32+
env:
33+
GH_TOKEN: ${{ github.token }}
34+
run: |
35+
set -euo pipefail
36+
for i in {1..60}; do
37+
assets="$(gh release view "$TAG" --json assets --jq '.assets[].name' || true)"
38+
if echo "$assets" | grep -q "diff-coverage-$TAG-x86_64-unknown-linux-musl" \
39+
&& echo "$assets" | grep -q "diff-coverage-$TAG-aarch64-unknown-linux-musl"; then
40+
exit 0
41+
fi
42+
echo "Waiting for release assets for $TAG..."
43+
sleep 10
44+
done
45+
echo "Release assets not found for $TAG"
46+
exit 1
47+
- name: Download release binaries
48+
env:
49+
GH_TOKEN: ${{ github.token }}
50+
run: |
51+
mkdir -p dist
52+
gh release download "$TAG" --pattern "diff-coverage-$TAG-x86_64-unknown-linux-musl" --dir dist
53+
gh release download "$TAG" --pattern "diff-coverage-$TAG-aarch64-unknown-linux-musl" --dir dist
54+
mv "dist/diff-coverage-$TAG-x86_64-unknown-linux-musl" "dist/diff-coverage-amd64"
55+
mv "dist/diff-coverage-$TAG-aarch64-unknown-linux-musl" "dist/diff-coverage-arm64"
56+
chmod +x dist/diff-coverage-amd64 dist/diff-coverage-arm64
57+
- uses: docker/setup-buildx-action@v3
58+
- uses: docker/login-action@v3
59+
with:
60+
username: ${{ secrets.DOCKERHUB_USERNAME }}
61+
password: ${{ secrets.DOCKERHUB_TOKEN }}
62+
- name: Docker meta
63+
id: meta
64+
uses: docker/metadata-action@v5
65+
with:
66+
images: ${{ env.IMAGE }}
67+
tags: |
68+
type=raw,value=latest
69+
type=semver,pattern={{version}},value=${{ env.VERSION }}
70+
type=semver,pattern={{major}},value=${{ env.VERSION }}
71+
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
72+
type=raw,value=alpine
73+
type=raw,value=alpine-${{ env.ALPINE_VERSION }}
74+
type=semver,pattern={{version}},value=${{ env.VERSION }},suffix=-alpine
75+
type=semver,pattern={{major}},value=${{ env.VERSION }},suffix=-alpine
76+
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }},suffix=-alpine
77+
type=semver,pattern={{version}},value=${{ env.VERSION }},suffix=-alpine-${{ env.ALPINE_VERSION }}
78+
type=semver,pattern={{major}},value=${{ env.VERSION }},suffix=-alpine-${{ env.ALPINE_VERSION }}
79+
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }},suffix=-alpine-${{ env.ALPINE_VERSION }}
80+
- name: Build and push (linux)
81+
uses: docker/build-push-action@v5
82+
with:
83+
context: .
84+
file: Dockerfile.release
85+
platforms: linux/amd64,linux/arm64
86+
push: true
87+
build-args: |
88+
ALPINE_VERSION=${{ env.ALPINE_VERSION }}
89+
tags: ${{ steps.meta.outputs.tags }}
90+
labels: ${{ steps.meta.outputs.labels }}

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# 0.2.0 - 2027-02-10
1+
# 0.2.1 - 2026-02-10
22

33
Added
44
- Dockerhub release
55

6+
# 0.2.0 - 2026-02-10
7+
68
Changed
79
- Output binaries in releases instead of archives with README
810

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diff-coverage"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55
description = "Diff-coverage, supercharged in Rust. Fast, memory-efficient coverage on changed lines for CI."
66
license = "MIT"

Dockerfile.release

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# syntax=docker/dockerfile:1.6
2+
ARG ALPINE_VERSION=3.20
3+
ARG TARGETARCH
4+
5+
FROM alpine:${ALPINE_VERSION}
6+
ARG TARGETARCH
7+
RUN apk add --no-cache ca-certificates
8+
COPY dist/diff-coverage-${TARGETARCH} /usr/local/bin/diff-coverage
9+
ENTRYPOINT ["diff-coverage"]

0 commit comments

Comments
 (0)