|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + new_version: |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + image_tag: |
| 10 | + type: string |
| 11 | + required: true |
| 12 | + python_version: |
| 13 | + type: string |
| 14 | + default: "3.10" |
| 15 | + required: true |
| 16 | + poetry_version: |
| 17 | + type: string |
| 18 | + default: "1.5.1" |
| 19 | + required: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + release: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: write |
| 26 | + steps: |
| 27 | + - name: Checkout the repository |
| 28 | + uses: actions/checkout@v3 |
| 29 | + - name: Change version in pyproject.toml |
| 30 | + |
| 31 | + with: |
| 32 | + file: "pyproject.toml" |
| 33 | + key: "tool.poetry.version" |
| 34 | + value: "${{ github.event.inputs.new_version }}" |
| 35 | + - name: Install Python |
| 36 | + uses: actions/setup-python@v4 |
| 37 | + with: |
| 38 | + python-version: ${{ github.event.inputs.python_version }} |
| 39 | + - name: Install Poetry |
| 40 | + uses: abatilo/actions-poetry@v2 |
| 41 | + with: |
| 42 | + poetry-version: ${{ github.event.inputs.poetry_version }} |
| 43 | + - name: Run poetry install |
| 44 | + run: poetry install --with docs |
| 45 | + - name: Run poetry build |
| 46 | + run: poetry build |
| 47 | + - name: Create new documentation |
| 48 | + run: poetry run pdoc --html -o docs src/codeflare_sdk && pushd docs && rm -rf cluster job utils && mv codeflare_sdk/* . && rm -rf codeflare_sdk && popd |
| 49 | + - name: Set Pypi token |
| 50 | + run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} |
| 51 | + - name: Publish new release to Pypi repository |
| 52 | + run: poetry publish -r test-pypi |
| 53 | + - name: Commit the pre-release changes |
| 54 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 55 | + with: |
| 56 | + commit_message: "New release: ${{ github.event.inputs.new_version }}" |
| 57 | + - name: Create Github release |
| 58 | + uses: ncipollo/release-action@v1 |
| 59 | + with: |
| 60 | + tag: "v${{ github.event.inputs.new_version }}" |
| 61 | + - name: Update SDK version in the Docker image |
| 62 | + run: sed -i "s/\(.*codeflare-sdk==\)[^\\s]*\(.*\)/\${{ github.event.inputs.new_version }}\2/" custom-nb-image/Dockerfile |
| 63 | + - name: Update Docker image version |
| 64 | + run: echo ${{ github.event.inputs.new_version }} > custom-nb-image/VERSION |
| 65 | + - name: Commit new version of the Docker image |
| 66 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 67 | + with: |
| 68 | + commit_message: "New image tag: ${{ github.event.inputs.image_tag }}" |
0 commit comments