update-models #16
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: | |
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 | |
- orca-2-13b | |
- llama-2-7b-chat-cuda | |
- llama-2-13b-chat-cuda | |
- orca-2-13b-cuda | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@9614fae9e5c5eddabb09f90a270fcb487c9f7149 # v3.3.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0 | |
- name: Login to GHCR | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.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]+)-.*/\1\2/')" >> $GITHUB_ENV | |
echo "MODEL_SIZE=$(echo ${{ matrix.model }} | sed -E 's/[a-z]+-[0-9]+-([0-9]+b).*/\1/')" >> $GITHUB_ENV | |
echo "MODEL_TYPE=$(echo ${{ matrix.model }} | sed -E 's/.*-([a-z]+)(-cuda)?$/\1/' | grep -Eo 'chat')" >> $GITHUB_ENV | |
echo "MODEL_RUNTIME=-$(echo ${{ matrix.model }} | sed -E 's/.*-(cuda)?$/\1/' | grep -Eo 'cuda')" >> $GITHUB_ENV | |
- name: Build and push | |
run: | | |
if [ "${MODEL_RUNTIME}" == "-" ]; then | |
export MODEL_RUNTIME="" | |
echo "MODEL_RUNTIME=''" >> $GITHUB_ENV | |
fi | |
docker buildx build . -t ghcr.io/sozercan/${MODEL_NAME}:${MODEL_SIZE}${MODEL_RUNTIME} \ | |
-f models/${{ matrix.model }}.yaml \ | |
--push --progress plain \ | |
--sbom=true --provenance=true \ | |
--cache-from=type=gha,scope=${MODEL_NAME}-${MODEL_SIZE} \ | |
--cache-to=type=gha,scope=${MODEL_NAME}-${MODEL_SIZE},mode=max | |
echo "DIGEST=$(cosign triangulate ghcr.io/sozercan/${MODEL_NAME}:${MODEL_SIZE}${MODEL_RUNTIME} --type digest)" >> $GITHUB_ENV | |
- name: Sign the images with GitHub OIDC Token | |
run: cosign sign --yes ${DIGEST} | |
- name: Verify image signature | |
run: | | |
cosign verify ${DIGEST} \ | |
--certificate-oidc-issuer https://token.actions.githubusercontent.com \ | |
--certificate-identity https://github.com/sozercan/aikit/.github/workflows/update-models.yaml@refs/heads/main |