update-models #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-models | |
on: | |
workflow_dispatch: | |
inputs: | |
staging: | |
description: 'push to staging registry' | |
required: false | |
default: false | |
type: boolean | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
jobs: | |
update-models: | |
strategy: | |
fail-fast: false | |
matrix: | |
model: | |
- llama-2-7b-chat | |
- llama-2-13b-chat | |
- llama-3-8b-instruct | |
- phi-3-3.8b | |
- gemma-1.1-2b-instruct | |
- codestral-0.1-22b | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
steps: | |
- uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
with: | |
tool-cache: true | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Harden Runner | |
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0 | |
with: | |
egress-policy: block | |
allowed-endpoints: > | |
auth.docker.io:443 | |
*.huggingface.co:443 | |
fulcio.sigstore.dev:443 | |
gcr.io:443 | |
ghcr.io:443 | |
github.com:443 | |
huggingface.co:443 | |
*.githubusercontent.com:443 | |
production.cloudflare.docker.com:443 | |
registry-1.docker.io:443 | |
rekor.sigstore.dev:443 | |
storage.googleapis.com:443 | |
tuf-repo-cdn.sigstore.dev:443 | |
sertaccdn.azureedge.net:443 | |
developer.download.nvidia.com:443 | |
deb.debian.org:80 | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
- uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0 | |
- name: Login to GHCR | |
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: parse matrix | |
run: | | |
echo "MODEL_NAME=$(echo ${{ matrix.model }} | sed -E 's/([a-z]+)-([0-9]+(\.[0-9]+)?)-.*/\1\2/')" >> $GITHUB_ENV | |
echo "MODEL_SIZE=$(echo ${{ matrix.model }} | sed -E 's/.*-([0-9]+b).*/\1/')" >> $GITHUB_ENV | |
echo "MODEL_TYPE=-$(echo ${{ matrix.model }} | sed -E 's/.*-[0-9]+(\.[0-9]+)?b(-([^ ]+))?$/\3/')" >> $GITHUB_ENV | |
- name: Build and push | |
run: | | |
if [ "${MODEL_TYPE}" == "-" ]; then | |
export MODEL_TYPE="" | |
echo "MODEL_TYPE=''" >> $GITHUB_ENV | |
fi | |
if ${{ inputs.staging }}; then | |
export REGISTRY=ghcr.io/sozercan/test | |
else | |
export REGISTRY=ghcr.io/sozercan | |
fi | |
docker buildx build . \ | |
-t ${REGISTRY}/${MODEL_NAME}:${MODEL_SIZE} \ | |
-t ${REGISTRY}/${MODEL_NAME}:${MODEL_SIZE}${MODEL_TYPE} \ | |
-f models/${{ matrix.model }}.yaml \ | |
--push --progress plain \ | |
--sbom=true --provenance=true | |
echo "DIGEST=$(cosign triangulate ${REGISTRY}/${MODEL_NAME}:${MODEL_SIZE} --type digest)" >> $GITHUB_ENV | |
- name: Sign the images with GitHub OIDC Token | |
if: ${{ !inputs.staging }} | |
run: cosign sign --yes ${DIGEST} | |
- name: Verify image signature | |
if: ${{ !inputs.staging }} | |
run: | | |
cosign verify ${DIGEST} \ | |
--certificate-oidc-issuer https://token.actions.githubusercontent.com \ | |
--certificate-identity-regexp 'https://github\.com/sozercan/aikit/\.github/workflows/.+' |