Skip to content

Commit 685161c

Browse files
feat(release): add build provenance attestations (#28)
* feat(release): add build provenance attestations - Add id-token and attestations permissions - Generate attestation for each build artifact using actions/attest-build-provenance@v1 - Attestations provide cryptographic proof of build integrity and source Users can verify attestations with: gh attestation verify <artifact> --owner RichardSlater * fix(release): extract GitHub username from commit author email - Use git log format '%aN <%aE>' to get both name and email - Extract GitHub username from @users.noreply.github.com emails via sed - Fall back to author name for non-GitHub emails - Ensures @mentions in release notes link to correct GitHub users Example transformations: 'Richard Slater <123456+RichardSlater@users.noreply.github.com>' -> '@RichardSlater' 'John Doe <john@example.com>' -> '@john Doe'
1 parent 457dae6 commit 685161c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222

2323
permissions:
2424
contents: write
25+
id-token: write
26+
attestations: write
2527

2628
jobs:
2729
build:
@@ -156,6 +158,11 @@ jobs:
156158
name: ${{ matrix.name }}
157159
path: release/
158160

161+
- name: Generate artifact attestation
162+
uses: actions/attest-build-provenance@v1
163+
with:
164+
subject-path: 'release/*.tar.gz,release/*.zip'
165+
159166
release:
160167
name: Create Release
161168
needs: build
@@ -199,16 +206,23 @@ jobs:
199206
run: |
200207
set -euo pipefail
201208
echo "Using release tag: $RELEASE_TAG"
209+
210+
# Function to format commit authors: extract GitHub username from email or use name
211+
format_authors() {
212+
sed -E 's/@([^<]+) <([^@]+)@users\.noreply\.github\.com>/@\2/g' | \
213+
sed -E 's/@([^<]+) <[^>]+>/@\1/g'
214+
}
215+
202216
# ensure tags are available
203217
git fetch --tags --prune || true
204218
# find previous tag by creation date (exclude current)
205219
PREV_TAG=$(git tag --sort=-creatordate | grep -v "^${RELEASE_TAG}$" | head -n1 || true)
206220
if [ -n "$PREV_TAG" ]; then
207221
RANGE="$PREV_TAG..$RELEASE_TAG"
208-
COMMITS=$(git log --pretty=format:'- %h %s — @%an' "$PREV_TAG..$RELEASE_TAG" || true)
222+
COMMITS=$(git log --pretty=format:'- %h %s — @%aN <%aE>' "$PREV_TAG..$RELEASE_TAG" | format_authors || true)
209223
else
210224
RANGE="$RELEASE_TAG"
211-
COMMITS=$(git log --pretty=format:'- %h %s — @%an' "$RELEASE_TAG" -n 50 || true)
225+
COMMITS=$(git log --pretty=format:'- %h %s — @%aN <%aE>' "$RELEASE_TAG" -n 50 | format_authors || true)
212226
fi
213227
if [ -z "$COMMITS" ]; then
214228
COMMITS="(no commits found)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Bromcom Timetable Formatter
22

33
[![CI](https://github.com/RichardSlater/bromcom-timetable-formatter/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/RichardSlater/bromcom-timetable-formatter/actions/workflows/ci.yml)
4-
[![Release Workflow](https://github.com/RichardSlater/bromcom-timetable-formatter/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/RichardSlater/bromcom-timetable-formatter/actions/workflows/release.yml)
4+
[![Release Workflow](https://github.com/RichardSlater/bromcom-timetable-formatter/actions/workflows/release.yml/badge.svg?event=push)](https://github.com/RichardSlater/bromcom-timetable-formatter/actions/workflows/release.yml)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
66

77
A small Rust workspace that parses Bromcom-produced PDF timetables and renders a printable A4 SVG-style weekly timetable, with a color-coded timetable grid and an embedded school map highlighting departments.

0 commit comments

Comments
 (0)