Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DeeAjayi committed Nov 4, 2024
1 parent 18748f6 commit 96b8a61
Showing 1 changed file with 45 additions and 69 deletions.
114 changes: 45 additions & 69 deletions .github/workflows/build-and-push-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,86 +20,62 @@ env:
TAG_PREFIX: "v"

jobs:
build_image:
name: Build Image
set_version_tags:
name: Set version tags
runs-on: ubuntu-latest
outputs:
version_tag: ${{ steps.set_version_tags.outputs.version_tag }}
jupyter_version_tag: ${{ steps.set_version_tags.outputs.jupyter_version_tag }}
alt_version_tag: ${{ steps.set_version_tags.outputs.alt_version_tag }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false

- name: Set version tags
id: set_version_tags
run: |
echo "Ref name is ${{ github.ref_name }}"
echo "TAG_PREFIX is ${{ env.TAG_PREFIX }}"
REF_NAME=${{ github.ref_name }}
TAG_PREFIX=${{ env.TAG_PREFIX }}
VERSION_TAG=$(echo $REF_NAME | cut -d $TAG_PREFIX -f 2-)
echo "Setting VERSION_TAG equal to $VERSION_TAG"
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
VERSION_TAG=$(echo $REF_NAME | awk -F$TAG_PREFIX '{print $2}')
echo "Setting VERSION_TAG to $VERSION_TAG"
echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT
JUPYTER_VERSION_TAG=$(echo $REF_NAME | cut -d $TAG_PREFIX -f 2-)-jupyter
echo "Setting JUPYTER VERSION_TAG equal to JUPYTER_VERSION_TAG"
echo "jupyter_version_tag=JUPYTER_VERSION_TAG" >> $GITHUB_OUTPUT
ALT_VERSION_TAG=$(echo $VERSION_TAG | awk -F- '{print $1}')-${GITHUB_SHA::7}
echo "Setting ALT_VERSION_TAG equal to $ALT_VERSION_TAG"
echo "ALT_VERSION_TAG=$ALT_VERSION_TAG" >> $GITHUB_ENV
echo "alt_version_tag=$ALT_VERSION_TAG" >> $GITHUB_OUTPUT
- name: Build and Push llm-finetune image
uses: truefoundry/workflows/.github/workflows/[email protected]
with:
image_tag: ${{ github.sha }}
extra_image_tag: |
${{ env.VERSION_TAG }}
${{ env.ALT_VERSION_TAG }}
platforms: linux/amd64
image_artifact_name: ${{ github.event.repository.name }}
artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
secrets:
artifactory_username: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_USERNAME }}
artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_PASSWORD }}

build_notebook_image:
name: Build Notebook Image
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false

- name: Set version tags
run: |
echo "Ref name is ${{ github.ref_name }}"
echo "TAG_PREFIX is ${{ env.TAG_PREFIX }}"
REF_NAME=${{ github.ref_name }}
TAG_PREFIX=${{ env.TAG_PREFIX }}
VERSION_TAG=$(echo $REF_NAME | cut -d $TAG_PREFIX -f 2-)-jupyter
echo "Setting VERSION_TAG equal to $VERSION_TAG"
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
build_finetune_image:
- name: Build and Push llm-finetune image
needs: set_version_tags
uses: truefoundry/workflows/.github/workflows/[email protected]
with:
image_tag: ${{ github.sha }}
extra_image_tag: |
${{ needs.set_version_tags.outputs.version_tag }}
${{ needs.set_version_tags.outputs.alt_version_tag }}
platforms: linux/amd64
free_disk_space: true
image_artifact_name: ${{ github.event.repository.name }}
artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
secrets:
artifactory_username: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_USERNAME }}
artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_PASSWORD }}

- name: Build and Push jupyter image
uses: truefoundry/workflows/.github/workflows/[email protected]
with:
image_tag: ${{ env.VERSION_TAG }}
platforms: linux/amd64
image_artifact_name: ${{ github.event.repository.name }}
artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
secrets:
artifactory_username: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_USERNAME }}
artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_PASSWORD }}
build_jupyter_image:
- name: Build and Push jupyter image
uses: truefoundry/workflows/.github/workflows/[email protected]
with:
image_tag: ${{ needs.set_version_tags.outputs.jupyter_version_tag }}
platforms: linux/amd64
free_disk_space: true
image_artifact_name: ${{ github.event.repository.name }}
artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
secrets:
artifactory_username: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_USERNAME }}
artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_PASSWORD }}

0 comments on commit 96b8a61

Please sign in to comment.