Skip to content

Nightly Builds

Nightly Builds #108

name: Nightly Builds
on:
schedule:
# Runs every weekday at 1am
- cron: 0 1 * * 1-5
workflow_dispatch:
jobs:
run_script_and_tag_nightly_release:
name: Run release script and tag a new nightly release
runs-on: ubuntu-22.04
outputs:
tag_name: ${{ steps.set_tagname.outputs.tag_name }}
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Python module
run: |
python3 -m pip install pluggy
python3 -m pip install ruamel.yaml
- name: Compose tag name
id: set_tagname
run: |
DATE=$(date +'%Y%m%d')
# Find latest rasa-oss version
echo "Trying to find the latest rasa-oss version..."
LATEST_RASA_MINOR=$(python -c "import sys; import os; sys.path.append('${{ github.workspace }}/rasa'); from rasa.version import __version__; print(__version__)")
echo "Current RASA version: ${LATEST_RASA_MINOR}"
LATEST_NIGHTLY_VERSION=$(echo ${LATEST_RASA_MINOR})
echo "Composing nightly build tag name..."
GH_TAG=${LATEST_NIGHTLY_VERSION}.dev${DATE}
echo "New nightly release version: ${GH_TAG}"
echo "tag_name=${GH_TAG}" >> $GITHUB_OUTPUT
- name: Tag latest main commit as nightly
run: |
git config user.name github-actions
git config user.email [email protected]
git tag -a ${{ steps.set_tagname.outputs.tag_name }} -m "This is an internal development build"
git push origin ${{ steps.set_tagname.outputs.tag_name }} --tags
deploy:
name: Deploy to PyPI
runs-on: ubuntu-22.04
# deploy will only be run when there is a tag available
needs: run_script_and_tag_nightly_release # only run after all other stages succeeded
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Set up Python 3.9 🐍
uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b
with:
python-version: 3.9
- name: Read Poetry Version 🔢
run: |
echo "POETRY_VERSION=$(scripts/poetry-version.sh)" >> $GITHUB_ENV
shell: bash
- name: Install poetry 🦄
uses: Gr1N/setup-poetry@15821dc8a61bc630db542ae4baf6a7c19a994844 # v8
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Copy Segment write key to the package
env:
RASA_TELEMETRY_WRITE_KEY: ${{ secrets.RASA_OSS_TELEMETRY_WRITE_KEY }}
RASA_EXCEPTION_WRITE_KEY: ${{ secrets.RASA_OSS_EXCEPTION_WRITE_KEY }}
run: |
./scripts/write_keys_file.sh
- name: Update version (nightly releases) 🚀
run: |
poetry run pip install toml pep440_version_utils
poetry run python ./scripts/prepare_nightly_release.py --next_version "${{ needs.run_script_and_tag_nightly_release.outputs.tag_name }}"
- name: Build ⚒️ Distributions
run: |
poetry build
# Authenticate and push to the release registry
- id: 'auth-release'
name: Authenticate with gcloud for release registry 🎫
uses: 'google-github-actions/auth@e8df18b60c5dd38ba618c121b779307266153fbf'
with:
credentials_json: '${{ secrets.RASA_OSS_RELEASE_ACCOUNT_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@62d4898025f6041e16b1068643bfc5a696863587'
- name: Release via GCP Artifact Registry
run: |
pip install keyring
pip install keyrings.google-artifactregistry-auth
pip install twine
gcloud artifacts print-settings python --project=rasa-releases --repository=rasa --location=europe-west3 > ~/.pypirc
twine upload --verbose --repository-url https://europe-west3-python.pkg.dev/rasa-releases/rasa/ ${{ format('{0}/dist/*', github.workspace) }}
docker:
name: Build Docker
runs-on: ubuntu-22.04
needs: run_script_and_tag_nightly_release
env:
GCLOUD_VERSION: "297.0.1"
# Registry used to store Docker images used for release purposes
DEV_REGISTRY: "europe-west3-docker.pkg.dev/rasa-ci-cd/rasa"
IMAGE_TAG: ${{ needs.run_script_and_tag_nightly_release.outputs.tag_name }}
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Free disk space
# tries to make sure we do not run out of disk space, see
# https://github.community/t5/GitHub-Actions/BUG-Strange-quot-No-space-left-on-device-quot-IOExceptions-on/td-p/46101
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Read Poetry Version 🔢
run: |
echo "POETRY_VERSION=$(scripts/poetry-version.sh)" >> $GITHUB_ENV
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c
id: buildx
with:
version: v0.5.1
driver: docker
- name: Copy Segment write key to the package
env:
RASA_TELEMETRY_WRITE_KEY: ${{ secrets.RASA_OSS_TELEMETRY_WRITE_KEY }}
RASA_EXCEPTION_WRITE_KEY: ${{ secrets.RASA_OSS_EXCEPTION_WRITE_KEY }}
run: |
./scripts/write_keys_file.sh
- name: Build Docker image
run: |
docker build . -t rasa/rasa:base-localdev -f docker/Dockerfile.base
docker build . -t rasa/rasa:base-builder-localdev -f docker/Dockerfile.base-builder --build-arg IMAGE_BASE_NAME=rasa/rasa --build-arg POETRY_VERSION=${{ env.POETRY_VERSION }}
docker build . -t rasa/rasa:base-poetry -f docker/Dockerfile.base-poetry --build-arg IMAGE_BASE_NAME=rasa/rasa --build-arg BASE_IMAGE_HASH=localdev
docker build . -t rasa/rasa:${IMAGE_TAG} -f Dockerfile --build-arg IMAGE_BASE_NAME=rasa/rasa --build-arg BASE_IMAGE_HASH=localdev --build-arg BASE_BUILDER_IMAGE_HASH=localdev
docker tag rasa/rasa:${IMAGE_TAG} ${{env.DEV_REGISTRY}}/rasa:${IMAGE_TAG}
# Authenticate and push to the release registry
- id: 'auth-dev'
name: Authenticate with gcloud for dev registry 🎫
uses: 'google-github-actions/auth@e8df18b60c5dd38ba618c121b779307266153fbf'
with:
credentials_json: '${{ secrets.RASA_OSS_RELEASE_ACCOUNT_KEY }}'
- name: Authenticate docker for dev registry 🎫
run: |
# Set up docker to authenticate via gcloud command-line tool.
gcloud auth configure-docker europe-west3-docker.pkg.dev
- name: Push image to release registry
run: |
docker push ${{env.DEV_REGISTRY}}/rasa:${IMAGE_TAG}