Repository navigation
179 lines (162 loc) · 5.54 KB
/
Copy pathrelease.yml
File metadata and controls
179 lines (162 loc) · 5.54 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to build/release (e.g. v0.14.0)"
required: true
permissions:
contents: write
packages: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
- name: Detect version
id: ver
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
REF="${{ inputs.tag }}"
else
REF="${GITHUB_REF_NAME}"
fi
echo "tag=$REF" >> "$GITHUB_OUTPUT"
echo "version=${REF#v}" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Mako
run: |
set -euo pipefail
# Clone Mako; submodules (quiche) may be incomplete — build best-effort without H3 if needed.
git clone --depth 1 https://github.com/loreste/mako.git "$HOME/mako"
cd "$HOME/mako"
git submodule update --init --recursive || {
echo "WARN: submodule init incomplete; continuing without full quiche tree"
}
if cargo install --path . --bin mako --locked 2>/tmp/mako-install.err; then
echo "mako installed (locked)"
else
cat /tmp/mako-install.err || true
cargo install --path . --bin mako
fi
# Compiler needs std/runtime trees (not only the binary).
echo "MAKO_STD=$HOME/mako/std" >> "$GITHUB_ENV"
echo "MAKO_RUNTIME=$HOME/mako/runtime" >> "$GITHUB_ENV"
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
"$HOME/.cargo/bin/mako" version
test -d "$HOME/mako/std/crypto"
test -d "$HOME/mako/runtime"
- name: Build binary
run: |
set -euo pipefail
export PATH="$HOME/.cargo/bin:$PATH"
export MAKO_STD="${MAKO_STD:-$HOME/mako/std}"
export MAKO_RUNTIME="${MAKO_RUNTIME:-$HOME/mako/runtime}"
make build
mkdir -p dist
cp leba "dist/leba-linux-amd64"
chmod +x "dist/leba-linux-amd64"
./leba version || true
- name: Checksums
run: |
cd dist
sha256sum leba-linux-amd64 > SHA256SUMS
cat SHA256SUMS
- name: SBOM (CycloneDX-ish minimal)
run: |
VERSION="${{ steps.ver.outputs.version }}"
cat > dist/sbom.cdx.json <<EOF
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"version": 1,
"metadata": {
"component": {
"type": "application",
"name": "leba",
"version": "${VERSION}",
"purl": "pkg:generic/leba@${VERSION}"
}
},
"components": [
{
"type": "library",
"name": "mako",
"description": "Language/runtime used to build Leba"
}
]
}
EOF
- name: Install cosign
uses: sigstore/cosign-installer@v3
- name: Sign binary (keyless OIDC)
env:
COSIGN_YES: "true"
run: |
set -euo pipefail
cosign sign-blob --yes \
--bundle dist/leba-linux-amd64.cosign.bundle \
dist/leba-linux-amd64
cosign verify-blob \
--bundle dist/leba-linux-amd64.cosign.bundle \
--certificate-identity-regexp 'https://github.com/loreste/leba/.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
dist/leba-linux-amd64
ls -la dist/
- name: Upload assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.ver.outputs.tag }}
files: |
dist/leba-linux-amd64
dist/SHA256SUMS
dist/sbom.cdx.json
dist/leba-linux-amd64.cosign.bundle
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
continue-on-error: true
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
continue-on-error: true
- name: Login GHCR
uses: docker/login-action@v3
continue-on-error: true
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Dockerfile expects a prebuilt leba binary in context
- name: Build and push multi-arch image
id: image
uses: docker/build-push-action@v6
continue-on-error: true
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ steps.ver.outputs.version }}
ghcr.io/${{ github.repository }}:latest
- name: Sign container image (keyless OIDC)
if: steps.image.outcome == 'success'
continue-on-error: true
env:
COSIGN_YES: "true"
run: |
set -euo pipefail
IMAGE="ghcr.io/${{ github.repository }}:${{ steps.ver.outputs.version }}"
cosign sign --yes "$IMAGE"
cosign verify \
--certificate-identity-regexp 'https://github.com/loreste/leba/.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
"$IMAGE"