|
48 | 48 | type=semver,pattern={{major}}.{{minor}} |
49 | 49 | type=sha,format=long |
50 | 50 | |
| 51 | + # ------------------------------------------------------------ |
| 52 | + # Build the runtime deterministically with srtool and capture |
| 53 | + # its SHA-256 so we can inject it as an OCI label. |
| 54 | + # ------------------------------------------------------------ |
| 55 | + - name: Build runtime with srtool & extract Wasm hash |
| 56 | + id: wasm |
| 57 | + run: | |
| 58 | + set -euo pipefail |
| 59 | + echo "🛠️ Running srtool to build compact runtime…" |
| 60 | + HASH=$(docker run --rm \ |
| 61 | + -v "${PWD}":/build \ |
| 62 | + --workdir /build \ |
| 63 | + paritytech/srtool:1.84.1 \ |
| 64 | + bash -c "/srtool/build >/dev/null 2>&1 && sha256sum runtime/fennel/target/srtool/release/wbuild/fennel-node-runtime/fennel_node_runtime.compact.wasm | awk '{print \"0x\"\$1}'") |
| 65 | + echo "WASM_HASH=$HASH" >> $GITHUB_ENV |
| 66 | + echo "hash=$HASH" >> $GITHUB_OUTPUT |
| 67 | + echo "✅ Deterministic Wasm hash: $HASH" |
| 68 | + |
51 | 69 | # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. |
52 | 70 | # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. |
53 | 71 | # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. |
|
58 | 76 | push: true |
59 | 77 | tags: ${{ steps.meta.outputs.tags }} |
60 | 78 | labels: ${{ steps.meta.outputs.labels }} |
| 79 | + build-args: | |
| 80 | + WASM_HASH=${{ env.WASM_HASH }} |
61 | 81 | cache-from: type=gha |
62 | 82 | cache-to: type=gha,mode=max |
63 | 83 |
|
|
66 | 86 | run: | |
67 | 87 | mkdir -p ./artifacts |
68 | 88 | echo "Image name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" > ./artifacts/image-info.txt |
69 | | - echo "Tags: ${{ steps.meta.outputs.tags }}" >> ./artifacts/image-info.txt |
70 | | - echo "Created: $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> ./artifacts/image-info.txt |
| 89 | + echo "Tags: ${{ steps.meta.outputs.tags }}" >> ./artifacts/image-info.txt |
| 90 | + echo "Wasm hash: ${{ env.WASM_HASH }}" >> ./artifacts/image-info.txt |
| 91 | + echo "Digest: ${{ steps.build-and-push-image.outputs.digest }}" >> ./artifacts/image-info.txt |
| 92 | + echo "Created: $(date -u +\"%Y-%m-%dT%H:%M:%SZ\")" >> ./artifacts/image-info.txt |
71 | 93 | |
72 | 94 | - name: Upload Docker image info artifact |
73 | 95 | uses: actions/upload-artifact@v4 |
|
0 commit comments