minor fixes #5
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: prepare-release | |
on: | |
# TODO: Change this back into pull_request | |
push: | |
branches: [misc/prepare-release-*] | |
env: | |
ZENML_ANALYTICS_OPT_IN: false | |
jobs: | |
prepare-release: | |
if: contains(github.event.head_commit.message, '[prepare]') # TODO: Remove | |
runs-on: ubuntu-latest | |
steps: | |
# 0. Check out the repository | |
- name: Checkout code | |
uses: actions/[email protected] | |
# 0. Extract the version name | |
- name: Extract version from branch name | |
run: | | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
VERSION=${BRANCH_NAME#misc/prepare-release-} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
# 0. Set up python | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.12' | |
# 0. Configure Git | |
- name: Configure git | |
shell: bash | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "ZenML GmbH" | |
# 0. Install ZenML | |
- name: Install ZenML and dependencies | |
shell: bash | |
run: | | |
scripts/install-zenml-dev.sh --system --integrations "no" | |
uv pip list | |
uv pip check || true | |
# # 1. Send a message to Discord to alert everyone for the release | |
# - name: Send message to Discord | |
# run: | | |
# curl -H "Content-Type: application/json" \ | |
# -d "{\"content\": \"New changes pushed to the main branch!\"}" \ | |
# ${{ secrets.DISCORD_WEBHOOK_URL }} | |
# 4. Alembic merge | |
- name: Run Alembic merge | |
shell: bash | |
run: | | |
alembic merge -m "Release" heads --rev-id ${{ env.VERSION }} | |
scripts/format.sh | |
git add src/zenml/zen_stores/migrations/versions | |
# 5. Update the main files | |
- name: Update main files | |
run: | | |
OLD_VERSION=$(cat src/zenml/VERSION) | |
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV | |
sed -i "s/$OLD_VERSION/${{ env.VERSION }}/g" README.md pyproject.toml src/zenml/VERSION src/zenml/zen_server/deploy/helm/Chart.yaml src/zenml/zen_server/deploy/helm/README.md | |
git add README.md pyproject.toml src/zenml/VERSION src/zenml/zen_server/deploy/helm/Chart.yaml src/zenml/zen_server/deploy/helm/README.md | |
# 5.5. Update the quickstart references | |
- name: Replace the references in the quickstart example | |
run: | | |
find examples/quickstart -type f \( -name "*.txt" -o -name "*.yaml" -o -name "*.ipynb" \) -print0 | | |
while IFS= read -r -d '' file; do | |
if [[ "$file" == *.ipynb ]]; then | |
# For .ipynb files, we need to parse JSON | |
jq --arg OLD "$OLD_VERSION" --arg NEW ${{ env.VERSION }} \ | |
'(.cells[] | select(.cell_type == "code") | .source) |= map(gsub($OLD; $NEW))' "$file" > "${file}.tmp" && mv "${file}.tmp" "$file" | |
else | |
# For .txt and .yaml files, we can use sed | |
sed -i "s/$OLD_VERSION/${{ env.VERSION }}/g" "$file" | |
fi | |
done | |
git add examples/quickstart | |
# 6. Generate and append release notes | |
- name: Generate release notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
RELEASE_NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes -F tag_name=${{ env.VERSION }} -F target_commitish=${{ github.sha }} -F previous_tag_name=${{ env.OLD_VERSION }} | jq -r '.body') | |
echo "$RELEASE_NOTES" >> RELEASE_NOTES.md | |
git add RELEASE_NOTES.md | |
# 7. Push the changes | |
# TODO: Change the reference to ${{ github.event.pull_request.head.ref }} | |
- name: Push the changes | |
run: | | |
git commit -m "Adding the new version to the necessary files." | |
git push origin HEAD:${{ github.ref }} | |
build-release: | |
if: contains(github.event.head_commit.message, '[build]') # TODO: Remove | |
runs-on: [ubuntu-latest] | |
steps: | |
# Check out the prepare-release branch | |
- name: Checkout code | |
uses: actions/[email protected] | |
# Extract the version name | |
- name: Extract version from branch name | |
run: | | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
VERSION=${BRANCH_NAME#misc/prepare-release-} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
# Configure Git | |
- name: Configure git | |
shell: bash | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "ZenML GmbH" | |
# Build the base image | |
- name: Build base image | |
run: | | |
docker build . \ | |
--platform linux/amd64 \ | |
-f docker/zenml-dev.Dockerfile \ | |
-t zenmldocker/prepare-release:base | |
docker images | |
# Build the server image | |
- name: Build server image | |
run: | | |
docker build . \ | |
--platform linux/amd64 \ | |
-f docker/zenml-server-dev.Dockerfile \ | |
-t zenmldocker/prepare-release:server | |
# Build the GCP quickstart image | |
- name: Build GCP quickstart image | |
run: | | |
docker build . \ | |
--platform linux/amd64 \ | |
--build-arg BASE_IMAGE=zenmldocker/prepare-release:base \ | |
--build-arg CLOUD_PROVIDER=gcp \ | |
--build-arg ZENML_BRANCH="${{ github.ref }}" \ | |
-f docker/zenml-quickstart-dev.Dockerfile \ | |
-t zenmldocker/prepare-release:quickstart-gcp | |
# Build the AWS quickstart image | |
- name: Build AWS quickstart image | |
run: | | |
docker build . \ | |
--platform linux/amd64 \ | |
--build-arg BASE_IMAGE=zenmldocker/prepare-release:base \ | |
--build-arg CLOUD_PROVIDER=aws \ | |
--build-arg ZENML_BRANCH="${{ github.ref }}" \ | |
-f docker/zenml-quickstart-dev.Dockerfile \ | |
-t zenmldocker/prepare-release:quickstart-aws | |
# Build the Azure quickstart image | |
- name: Build Azure quickstart image | |
run: | | |
docker build . \ | |
--platform linux/amd64 \ | |
--build-arg BASE_IMAGE=zenmldocker/prepare-release:base \ | |
--build-arg CLOUD_PROVIDER=azure \ | |
--build-arg ZENML_BRANCH="${{ github.ref }}" \ | |
-f docker/zenml-quickstart-dev.Dockerfile \ | |
-t zenmldocker/prepare-release:quickstart-azure | |
# Login to docker hub | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
if: github.event.pull_request.head.repo.fork == false | |
# Push the docker images | |
- name: Push the images | |
run: | | |
docker push zenmldocker/prepare-release:base | |
docker push zenmldocker/prepare-release:server | |
docker push zenmldocker/prepare-release:quickstart-gcp | |
docker push zenmldocker/prepare-release:quickstart-azure | |
test-release: | |
if: contains(github.event.head_commit.message, '[test]') # TODO: Remove | |
runs-on: [ ubuntu-latest ] | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Redeploy the tenant | |
run: echo "redeploy" # TODO: Implement | |
- name: Connect to the tenant | |
run: | # TODO: Implement | |
echo "connect" | |
cd examples/quickstart | |
- name: Run on AWS | |
run: | | |
zenml stack set aws | |
python run.py --model_type=t5-small | |
- name: Run on GCP | |
run: | | |
zenml stack set gcp | |
python run.py --model_type=t5-small | |
- name: Run on Azure | |
run: | | |
zenml stack set azure | |
python run.py --model_type=t5-small |