@@ -3,7 +3,7 @@ name: Release
33on :
44 push :
55 tags :
6- - ' v*'
6+ - ' varnish9- v*'
77
88permissions :
99 contents : write
@@ -38,24 +38,42 @@ jobs:
3838 --load \
3939 -t vmod-wasm-release-${{ matrix.arch }} .
4040
41- - name : Extract version from tag
41+ - name : Extract release metadata
4242 id : version
43- run : echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
43+ shell : bash
44+ run : |
45+ case "$GITHUB_REF_NAME" in
46+ varnish9-v*) version="${GITHUB_REF_NAME#varnish9-v}" ;;
47+ *)
48+ echo "::error::Release tags must match varnish9-vX.Y.Z"
49+ exit 1
50+ ;;
51+ esac
52+
53+ if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
54+ echo "::error::Invalid release version: $version"
55+ exit 1
56+ fi
57+
58+ echo "version=$version" >> "$GITHUB_OUTPUT"
59+ echo "artifact_prefix=vmod-wasm-varnish9-$version" >> "$GITHUB_OUTPUT"
4460
4561 - name : Package binary artifact
4662 env :
4763 VERSION : ${{ steps.version.outputs.version }}
64+ ARTIFACT_PREFIX : ${{ steps.version.outputs.artifact_prefix }}
4865 ARCH : ${{ matrix.arch }}
4966 run : |
5067 mkdir -p dist
5168 docker run --rm --platform linux/${{ matrix.arch }} \
5269 -e VERSION="$VERSION" \
70+ -e ARTIFACT_PREFIX="$ARTIFACT_PREFIX" \
5371 -e ARCH="$ARCH" \
5472 -e WASMTIME_VERSION="${{ env.WASMTIME_VERSION }}" \
5573 -e VARNISH_VERSION="${{ env.VARNISH_VERSION }}" \
5674 -v "$PWD/dist:/dist" \
5775 vmod-wasm-release-${{ matrix.arch }} sh -ceu '
58- pkg="/tmp/vmod-wasm-${VERSION}-varnish9 -linux-${ARCH}"
76+ pkg="/tmp/${ARTIFACT_PREFIX} -linux-${ARCH}"
5977 mkdir -p "$pkg/lib" "$pkg/licenses"
6078 cp /src/src/.libs/libvmod_wasm.so "$pkg/lib/"
6179 cp -a /opt/wasmtime/lib/libwasmtime.so* "$pkg/lib/"
@@ -70,13 +88,13 @@ jobs:
7088 Install both shared libraries into your VMOD/runtime library location or
7189 keep this bundle together and expose the lib directory to varnishd:
7290
73- export LD_LIBRARY_PATH=/path/to/vmod-wasm-${VERSION}-varnish9 -linux-${ARCH}/lib:\$LD_LIBRARY_PATH
91+ export LD_LIBRARY_PATH=/path/to/${ARTIFACT_PREFIX} -linux-${ARCH}/lib:\$LD_LIBRARY_PATH
7492
7593 The VMOD is built and tested against Varnish ${VARNISH_VERSION}. Source
7694 builds remain the authoritative path for custom Varnish installations.
7795 EOF
78- tar -czf "/dist/vmod-wasm-${VERSION}-varnish9 -linux-${ARCH}.tar.gz" \
79- -C /tmp "vmod-wasm-${VERSION}-varnish9 -linux-${ARCH}"
96+ tar -czf "/dist/${ARTIFACT_PREFIX} -linux-${ARCH}.tar.gz" \
97+ -C /tmp "${ARTIFACT_PREFIX} -linux-${ARCH}"
8098 {
8199 echo "arch=${ARCH}"
82100 echo "varnish_version=$(/usr/sbin/varnishd -V 2>&1 | head -n1)"
@@ -89,42 +107,44 @@ jobs:
89107 if : matrix.arch == 'amd64'
90108 env :
91109 VERSION : ${{ steps.version.outputs.version }}
110+ ARTIFACT_PREFIX : ${{ steps.version.outputs.artifact_prefix }}
92111 run : |
93112 docker run --rm --platform linux/${{ matrix.arch }} \
94113 -e VERSION="$VERSION" \
114+ -e ARTIFACT_PREFIX="$ARTIFACT_PREFIX" \
95115 -v "$PWD/dist:/dist" \
96116 vmod-wasm-release-${{ matrix.arch }} sh -ceu '
97117 make dist
98- cp "vmod-wasm-${VERSION}.tar.gz" "/dist/vmod-wasm-${VERSION }-src.tar.gz"
99- tmp="/tmp/vmod-wasm-${VERSION }-examples-wasm"
118+ cp "vmod-wasm-${VERSION}.tar.gz" "/dist/${ARTIFACT_PREFIX }-src.tar.gz"
119+ tmp="/tmp/${ARTIFACT_PREFIX }-examples-wasm"
100120 mkdir -p "$tmp"
101121 cp /src/tests/wasm/*.wasm "$tmp/"
102122 cp /src/examples/edge-security-filter/config.json "$tmp/edge-security-filter-config.json"
103- tar -czf "/dist/vmod-wasm-${VERSION }-examples-wasm.tar.gz" \
104- -C /tmp "vmod-wasm-${VERSION }-examples-wasm"
123+ tar -czf "/dist/${ARTIFACT_PREFIX }-examples-wasm.tar.gz" \
124+ -C /tmp "${ARTIFACT_PREFIX }-examples-wasm"
105125 '
106126
107127 - name : Smoke test binary bundle
108128 env :
109- VERSION : ${{ steps.version.outputs.version }}
129+ ARTIFACT_PREFIX : ${{ steps.version.outputs.artifact_prefix }}
110130 ARCH : ${{ matrix.arch }}
111131 run : |
112132 docker run --rm --platform linux/${{ matrix.arch }} \
113- -e VERSION ="$VERSION " \
133+ -e ARTIFACT_PREFIX ="$ARTIFACT_PREFIX " \
114134 -e ARCH="$ARCH" \
115135 -v "$PWD/dist:/dist" \
116136 varnish:${{ env.VARNISH_VERSION }} sh -ceu '
137+ pkg="/tmp/pkg/${ARTIFACT_PREFIX}-linux-${ARCH}"
117138 mkdir -p /tmp/pkg
118- tar -xzf "/dist/vmod-wasm-${VERSION}-varnish9-linux-${ARCH}.tar.gz" -C /tmp/pkg
119- pkg=$(find /tmp/pkg -maxdepth 1 -type d -name "vmod-wasm-*" | head -n1)
139+ tar -xzf "/dist/${ARTIFACT_PREFIX}-linux-${ARCH}.tar.gz" -C /tmp/pkg
120140 LD_LIBRARY_PATH="$pkg/lib" ldd "$pkg/lib/libvmod_wasm.so" | tee /tmp/ldd.txt
121141 grep "libwasmtime.so.*=>.*$pkg/lib" /tmp/ldd.txt
122142 '
123143
124144 - name : Upload artifacts
125145 uses : actions/upload-artifact@v4
126146 with :
127- name : release-${{ matrix.arch }}
147+ name : release-varnish9- ${{ matrix.arch }}
128148 path : dist/
129149
130150 release :
@@ -136,27 +156,86 @@ jobs:
136156 with :
137157 fetch-depth : 0
138158
139- - name : Extract version from tag
159+ - name : Extract release metadata
140160 id : version
141- run : echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
161+ shell : bash
162+ run : |
163+ case "$GITHUB_REF_NAME" in
164+ varnish9-v*) version="${GITHUB_REF_NAME#varnish9-v}" ;;
165+ *)
166+ echo "::error::Release tags must match varnish9-vX.Y.Z"
167+ exit 1
168+ ;;
169+ esac
170+
171+ if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
172+ echo "::error::Invalid release version: $version"
173+ exit 1
174+ fi
142175
143- - name : Extract changelog section
144- id : changelog
176+ echo "version=$version" >> "$GITHUB_OUTPUT"
177+ echo "artifact_prefix=vmod-wasm-varnish9-$version" >> "$GITHUB_OUTPUT"
178+
179+ - name : Build release notes
180+ env :
181+ VERSION : ${{ steps.version.outputs.version }}
182+ ARTIFACT_PREFIX : ${{ steps.version.outputs.artifact_prefix }}
183+ WASMTIME_VERSION : ${{ env.WASMTIME_VERSION }}
184+ VARNISH_VERSION : ${{ env.VARNISH_VERSION }}
145185 run : |
146- version="${{ steps.version.outputs.version }}"
147- notes=$(awk -v ver="$version" '
148- /^## \[/ {
149- if (found) exit
150- if (index($0, "[" ver "]")) found=1
151- next
152- }
153- found { print }
154- ' CHANGELOG.md)
155- {
156- echo "notes<<EOF"
157- echo "$notes"
158- echo "EOF"
159- } >> "$GITHUB_OUTPUT"
186+ python3 - <<'PY'
187+ import os
188+
189+ version = os.environ["VERSION"]
190+ artifact_prefix = os.environ["ARTIFACT_PREFIX"]
191+ wasmtime_version = os.environ["WASMTIME_VERSION"]
192+ varnish_version = os.environ["VARNISH_VERSION"]
193+ tag = os.environ["GITHUB_REF_NAME"]
194+
195+ lines = open("CHANGELOG.md", encoding="utf-8").read().splitlines()
196+ notes = []
197+ found = False
198+ for line in lines:
199+ if line.startswith("## ["):
200+ if found:
201+ break
202+ found = line.startswith(f"## [{version}]")
203+ continue
204+ if found:
205+ notes.append(line)
206+
207+ changelog = "\n".join(notes).strip() or "See the repository changelog for details."
208+ body = "\n".join([
209+ f"# Varnish 9 / v{version}",
210+ "",
211+ f"This release targets Varnish 9.x and bundles Wasmtime {wasmtime_version}.",
212+ f"Use the `{tag}` release channel for Varnish 9-compatible builds.",
213+ "",
214+ "## Compatibility",
215+ f"- Varnish: 9.x, validated with `varnish:{varnish_version}`",
216+ f"- Wasmtime: {wasmtime_version}, bundled in binary tarballs",
217+ "- Platforms: linux/amd64 and linux/arm64",
218+ "- VCL API: no compatibility break from v4.3.0",
219+ "",
220+ "## Changes",
221+ changelog,
222+ "",
223+ "## Assets",
224+ f"- `{artifact_prefix}-src.tar.gz`",
225+ f"- `{artifact_prefix}-linux-amd64.tar.gz`",
226+ f"- `{artifact_prefix}-linux-arm64.tar.gz`",
227+ f"- `{artifact_prefix}-examples-wasm.tar.gz`",
228+ f"- `manifest-varnish9-{version}.json`",
229+ "- `SHA256SUMS`",
230+ "",
231+ "## Verification",
232+ f"Binary bundles are smoke tested in a fresh `varnish:{varnish_version}` container,",
233+ "including an `ldd` check that `libvmod_wasm.so` resolves the bundled `libwasmtime.so`.",
234+ "`SHA256SUMS` covers all release tarballs and the manifest.",
235+ "",
236+ ])
237+ open("release-notes.md", "w", encoding="utf-8").write(body)
238+ PY
160239
161240 - name : Download all artifacts
162241 uses : actions/download-artifact@v4
@@ -190,6 +269,8 @@ jobs:
190269 manifest = {
191270 "name": "vmod-wasm",
192271 "version": version,
272+ "release_channel": "varnish9",
273+ "tag": os.environ["GITHUB_REF_NAME"],
193274 "git_sha": os.environ["GITHUB_SHA"],
194275 "support": {
195276 "varnish": "9.x",
@@ -202,18 +283,19 @@ jobs:
202283 for path in glob.glob("release-dist/*.tar.gz")
203284 ),
204285 }
205- with open(f"release-dist/manifest-{version}.json", "w", encoding="utf-8") as fh:
286+ with open(f"release-dist/manifest-varnish9- {version}.json", "w", encoding="utf-8") as fh:
206287 json.dump(manifest, fh, indent=2)
207288 fh.write("\n")
208289 PY
209290 cd release-dist
210- sha256sum *.tar.gz "manifest-${VERSION}.json" > SHA256SUMS
291+ sha256sum *.tar.gz "manifest-varnish9- ${VERSION}.json" > SHA256SUMS
211292
212293 - name : Create GitHub Release
213294 env :
214295 GH_TOKEN : ${{ github.token }}
296+ VERSION : ${{ steps.version.outputs.version }}
215297 run : |
216298 gh release create "$GITHUB_REF_NAME" \
217- --title "$GITHUB_REF_NAME " \
218- --notes "${{ steps.changelog.outputs. notes }}" \
299+ --title "Varnish 9 / v${VERSION} " \
300+ --notes-file release- notes.md \
219301 release-dist/*
0 commit comments