Skip to content

fix: json upload

fix: json upload #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Release
runs-on: large
permissions:
contents: write
packages: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ollama-nitro image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: ollama-nitro:latest
- name: Build EIF builder
uses: docker/build-push-action@v5
with:
context: eif-builder
push: false
load: true
tags: eif-builder:latest
- name: Build EIF image
run: |
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):/output \
-e EIF_FILE=tinfoil-enclave-ollama-${{ github.ref_name }}.eif \
-e INFO_FILE=tinfoil-enclave-ollama-${{ github.ref_name }}-info.json \
-e DOCKER_IMAGE=ollama-nitro:latest \
eif-builder:latest
- name: Extract measurements predicate
run: |
jq -r ".Measurements" tinfoil-enclave-ollama-${{ github.ref_name }}-info.json > predicate.json
- name: Attest
uses: actions/attest@v1
id: attest
with:
subject-path: tinfoil-enclave-ollama-${{ github.ref_name }}.eif
predicate-type: https://tinfoil.sh/predicate/nitro-enclave-measurements/v1
predicate-path: predicate.json
- name: Move artifact to upload directory
run: |
mkdir upload
sudo mv tinfoil-enclave-ollama-${{ github.ref_name }}.eif upload/tinfoil-enclave-ollama-${{ github.ref_name }}.eif
sha256sum tinfoil-enclave-ollama-${{ github.ref_name }}.eif | cut -d ' ' -f 1 > upload/tinfoil-enclave-ollama-${{ github.ref_name }}.eif.sha256
- name: Upload artifact
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: upload
destination-dir: ./
- name: Generate release notes
id: generate-release-notes
run: |
RELEASE_NOTES=$(cat << EOF
Measurements:
\`\`\`
$(cat predicate.json)
\`\`\`
Log: https://search.sigstore.dev?logIndex=$(jq -r ".verificationMaterial.tlogEntries[0].logIndex" ${{ steps.attest.outputs.bundle-path }})
EIF image: https://enclave-images.tinfoil.sh/tinfoil-enclave-ollama-${{ github.ref_name }}.eif
EIF hash: $(cat upload/tinfoil-enclave-ollama-${{ github.ref_name }}.eif.sha256)
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: |
upload/tinfoil-enclave-ollama-${{ github.ref_name }}-info.json
upload/tinfoil-enclave-ollama-${{ github.ref_name }}.eif.sha256
body: ${{ steps.generate-release-notes.outputs.release-notes }}