-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
95 lines (83 loc) · 2.61 KB
/
action.yaml
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
name: Tinfoil Nitro Enclave Build Action
description: |
Builds, attests, and publishes AWS Nitro Enclave images.
author: Tinfoil
inputs:
docker-context:
description: "Docker build context"
required: false
default: "."
github-token:
description: "GitHub token"
required: true
runs:
using: "composite"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build main image
uses: docker/build-push-action@v5
with:
context: ${{ inputs.docker-context }}
push: false
load: true
tags: enclave-image:latest
- name: Build EIF image
shell: bash
run: |
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):/output \
-e EIF_FILE=enclave.eif \
-e INFO_FILE=enclave-info.json \
-e DOCKER_IMAGE=enclave-image:latest \
ghcr.io/tinfoilanalytics/eif-builder:e41cf52bd11eabce7080bc9f427554a7c6f46d8e
- name: Extract measurements predicate
shell: bash
run: |
jq -r ".Measurements" enclave-info.json > predicate.json
ls -lh enclave*
- name: Attest
uses: actions/attest@v1
id: attest
with:
subject-path: enclave.eif
predicate-type: https://tinfoil.sh/predicate/aws-nitro-enclave/v1
predicate-path: predicate.json
- uses: oras-project/setup-oras@v1
- name: Log into ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.github-token }}
- name: Build OCI image
shell: bash
run: |
oras push \
--export-manifest manifest.json \
"ghcr.io/${{ github.repository }}:${{ github.ref_name }}" \
"enclave.eif" \
"enclave-info.json"
- name: Generate release notes
id: generate-release-notes
shell: bash
run: |
RELEASE_NOTES=$(cat << EOF
OCI image: [\`ghcr.io/${{ github.repository }}:${{ github.ref_name }}\`](https://ghcr.io/${{ github.repository }}:${{ github.ref_name }})
EIF hash: $(sha256sum enclave.eif | cut -d ' ' -f 1)
Measurements:
\`\`\`
$(cat predicate.json)
\`\`\`
EOF
)
echo "release-notes<<EOF" >> "$GITHUB_OUTPUT"
echo "${RELEASE_NOTES}" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
enclave-info.json
body: ${{ steps.generate-release-notes.outputs.release-notes }}