Skip to content

Release

Release #17

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
release-version:
type: string
required: true
description: 'Version number (for example: 0.1.0)'
is-stable:
description: 'Select if the built image should be tagged as stable'
required: true
type: boolean
quay-organization:
description: 'Quay organization used to push the built images to'
required: true
default: 'project-codeflare'
python_version:
type: string
default: "3.8"
required: true
poetry_version:
type: string
default: "1.5.1"
required: true
codeflare-repository-organization:
type: string
default: "project-codeflare"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # This permission is required for trusted publishing
env:
PR_BRANCH_NAME: adjustments-release-${{ github.event.inputs.release-version }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ github.event.inputs.python_version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ github.event.inputs.poetry_version }}
- name: Change version in pyproject.toml
run: poetry version "${{ github.event.inputs.release-version }}"
- name: Run poetry install
run: poetry install --with docs
- name: Run poetry build
run: poetry build
- name: Create new documentation
run: poetry run pdoc --html -o docs/detailed-documentation src/codeflare_sdk && pushd docs/detailed-documentation && rm -rf cluster job utils && mv codeflare_sdk/* . && rm -rf codeflare_sdk && popd && find docs/detailed-documentation -type f -name "*.html" -exec bash -c "echo '' >> {}" \;
- name: Commit changes in docs
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: 'docs'
commit_message: "Changes in docs for release: v${{ github.event.inputs.release-version }}"
create_branch: true
branch: ${{ env.PR_BRANCH_NAME }}
- name: Create a PR with code changes
run: |
if git branch -a | grep "${{ env.PR_BRANCH_NAME }}"; then
GIT_BRANCH=${GITHUB_REF#refs/heads/}
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH_NAME }}" --label "lgtm" --label "approved"
fi
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
- name: Wait until PR with code changes is merged
run: |
if git branch -a | grep "${{ env.PR_BRANCH_NAME }}"; then
timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state)"; done'
fi
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
- name: Create Github release
uses: ncipollo/release-action@v1
with:
tag: "v${{ github.event.inputs.release-version }}"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Notebook Image Build and Push
run: |
gh workflow run image-build-and-push.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field release-version=${{ github.event.inputs.release-version }} --field quay-organization=${{ github.event.inputs.quay-organization }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
- name: Wait for Notebook image build and push to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow image-build-and-push.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash