Skip to content

try out prov

try out prov #3

name: Train and Inference with SLSA
on:
push:
branches:
- main
jobs:
train:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Generate Dataset
run: |
python generate_dataset.py
tar -czvf dataset.tgz dataset.npz
- name: Train Model
run: python train_model.py
- name: Generate SLSA Attestation for Dataset
run: |
checksum=$(sha256sum dataset.tgz | cut -d ' ' -f 1)
echo "Dataset checksum: $checksum"
# Use the checksum to generate SLSA attestation
- name: Generate SLSA Attestation for Model
run: |
checksum=$(sha256sum model.pth | cut -d ' ' -f 1)
echo "Model checksum: $checksum"
# Use the checksum to generate SLSA attestation
provenance:
if: ${{ github.event_name != 'pull_request' }}
needs: [train]
runs-on: ubuntu-latest
permissions:
actions: read
id-token: write
contents: write
steps:
- name: Get outputs
id: hash
run: echo "::set-output name=hash::$(echo 'hash-'$(sha256sum dataset.tgz | cut -d ' ' -f 1) 'hash-'$(sha256sum model.pth | cut -d ' ' -f 1))"
- name: Run SLSA generator
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: ${{ steps.hash.outputs.hash }}
upload-assets: true